From 57e7f9a2becfd531c13d82fccd93c55d9cb94d31 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Mon, 9 Nov 2020 10:50:09 +0200 Subject: [PATCH 1/2] Fix #5172 --- src/shared/containers/ContentfulLoader.jsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/shared/containers/ContentfulLoader.jsx b/src/shared/containers/ContentfulLoader.jsx index cf82b0614d..858642d330 100644 --- a/src/shared/containers/ContentfulLoader.jsx +++ b/src/shared/containers/ContentfulLoader.jsx @@ -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 @@ -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))); } @@ -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(); } /** From 7b1eaef373cc2bb6f3c91fbb33ece942df546feb Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Mon, 9 Nov 2020 05:57:38 -0300 Subject: [PATCH 2/2] ci: deploy media-queries-fix to Stag env Issue: #5172 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index abe65e8480..f537138094 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -260,7 +260,7 @@ workflows: filters: branches: only: - - develop + - media-queries-fix # Production builds are exectuted # when PR is merged to the master # Don't change anything in this configuration