Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix scroll offset popping around during image load by putting explicit height back on images #248

Merged
merged 5 commits into from
Mar 28, 2016

Conversation

ara4n
Copy link
Member

@ara4n ara4n commented Mar 24, 2016

No description provided.

@ara4n ara4n changed the title WIP fix for image load popping Fix scroll offset popping around during image load by putting explicit height back on images Mar 24, 2016
@ara4n
Copy link
Member Author

ara4n commented Mar 24, 2016

fixes element-hq/element-web#1231

@ara4n
Copy link
Member Author

ara4n commented Mar 24, 2016

@richvdh ptal

onResize: function() {
this.props.onResize();
this.checkScroll();
this.refs.geminiPanel.forceUpdate();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really shouldn't be necessary. Let me have a look at what's going on here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's going on here is I'm an idiot.

* use string refs instead of callback funcs
* Add a null-guard in case we don't have an image
@ara4n
Copy link
Member Author

ara4n commented Mar 24, 2016

richvdh: i'm dubious about switching the closure refs to the null-guarded string refs in the popping fix - surely if the ref fails because the image doesn't exist on the initial pass, we'll still get the popping because the initial layout won't have a pinned image height?
or did you check that it didn't introduce popping?
The switch to string refs doesn't affect that though.
richvdh: howso? the ref is always null on componentDidMount, so surely the height fixup will return too late
whereas empirically the closure ref was set by the time componentDidMount ran

@richvdh
Copy link
Member

richvdh commented Mar 24, 2016

The ref should not be null in componentdidmount.

On 24 March 2016 18:22:23 GMT+00:00, Matthew Hodgson [email protected] wrote:

richvdh: i'm dubious about switching the closure refs to the
null-guarded string refs in the popping fix - surely if the ref fails
because the image doesn't exist on the initial pass, we'll still get
the popping because the initial layout won't have a pinned image
height?
or did you check that it didn't introduce popping?
The switch to string refs doesn't affect that though.
richvdh: howso? the ref is always null on componentDidMount,
so surely the height fixup will return too late
whereas empirically the closure ref was set by the time
componentDidMount ran


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#248 (comment)

@ara4n
Copy link
Member Author

ara4n commented Mar 28, 2016

ah ha! i see what was happening - because i was firing fixupHeight from componentDidUpdate it was firing seemingly before componentDidMount(?!), hence null ref. Have added warning logging to catch if the ref is ever null, removed some extraneous console logging, but i think we're good to go now. I'm going to declare this reviewed somewhere between the vdh/moi joint effort here...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants