File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ export default class ViewportCollector extends React.PureComponent<IProps> {
179179 private scrollMightHaveUpdated : boolean ;
180180 private resizeMightHaveUpdated : boolean ;
181181 private resizeObserver : ResizeObserver | null ;
182+ public syncedStateOnce : boolean ;
182183
183184 constructor ( props : IProps ) {
184185 super ( props ) ;
@@ -192,6 +193,7 @@ export default class ViewportCollector extends React.PureComponent<IProps> {
192193 this . lastSyncedDimensionsState = { ...this . dimensionsState } ;
193194 this . lastSyncedScrollState = { ...this . scrollState } ;
194195 this . resizeObserver = null ;
196+ this . syncedStateOnce = false ;
195197 }
196198
197199 componentDidMount ( ) {
@@ -272,6 +274,9 @@ export default class ViewportCollector extends React.PureComponent<IProps> {
272274 ) ;
273275
274276 syncState = ( ) => {
277+ if ( ! this . syncedStateOnce ) {
278+ this . syncedStateOnce = true ;
279+ }
275280 if ( this . scrollMightHaveUpdated ) {
276281 Object . assign ( this . scrollState , getClientScroll ( this . scrollState ) ) ;
277282 }
Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ export default class ViewportProvider extends React.PureComponent<
252252 this . initializeListenersTick = requestAnimationFrame ( ( ) => {
253253 if (
254254 this . collector . current &&
255+ this . collector . current . syncedStateOnce &&
255256 this . listeners . some ( l => ! l . initialized )
256257 ) {
257258 this . triggerUpdateToListeners (
@@ -278,10 +279,10 @@ export default class ViewportProvider extends React.PureComponent<
278279 removeViewportChangeListener : this . removeViewportChangeListener ,
279280 scheduleReinitializeChangeHandler : this . scheduleReinitializeChangeHandler ,
280281 getCurrentViewport : ( ) => {
281- if ( ! this . collector . current ) {
282- return this . getCurrentDefaultViewport ( ) ;
282+ if ( this . collector . current && this . collector . current . syncedStateOnce ) {
283+ return this . collector . current . getPropsFromState ( ) ;
283284 }
284- return this . collector . current . getPropsFromState ( ) ;
285+ return this . getCurrentDefaultViewport ( ) ;
285286 } ,
286287 hasRootProviderAsParent : true ,
287288 version : '__VERSION__' ,
You can’t perform that action at this time.
0 commit comments