Skip to content

Media queries fix #5185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ workflows:
filters:
branches:
only:
- pass-screen-updates
- develop
# Production builds are exectuted
# when PR is merged to the master
# Don't change anything in this configuration
Expand Down
18 changes: 17 additions & 1 deletion src/shared/containers/ContentfulLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React from 'react';
import shortId from 'shortid';
import qs from 'qs';
import SSR from 'utils/SSR';
import { config } from 'topcoder-react-utils';
import { config, isomorphy } from 'topcoder-react-utils';
import { connect } from 'react-redux';

// Setting those to infinity to disable maxage and auto refresh
Expand Down Expand Up @@ -156,6 +156,10 @@ class ContentfulLoader extends React.Component {
const b = this.loadContentOnMount(entryIds, 'entries', timeLimit);
const c = this.loadQueriesOnMount(assetQueries, 'assets', timeLimit);
const d = this.loadQueriesOnMount(entryQueries, 'entries', timeLimit);
if (isomorphy.isClientSide()) {
this.handleResize = _.throttle(this.handleResize.bind(this), 250);
window.addEventListener('resize', this.handleResize);
}
return Promise.all([...a, ...b, ...c, ...d])
.then(() => new Promise(resolve => setTimeout(() => resolve(), 100)));
}
Expand Down Expand Up @@ -208,6 +212,18 @@ class ContentfulLoader extends React.Component {
const ids = toArray(entryQueries).map(query => queryToMd5(query));
ids.forEach(id => freeQuery(id, 'entries', preview, spaceName, environment));
}

if (isomorphy.isClientSide()) {
window.removeEventListener('resize', this.handleResize);
}
}

/**
* On window resize trigger render
* for this and all child componets
*/
handleResize() {
this.forceUpdate();
}

/**
Expand Down