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

MELS: check scroll on load + use mels-1,-2,... key #715

Merged
merged 2 commits into from
Feb 23, 2017

Conversation

lukebarnard1
Copy link
Contributor

To fix element-hq/element-web#2916, force the checking of scroll position by calling _onWidgetLoad (might need renaming...) when a MELS is expanded/contracted.

Also use an keying scheme for MELS that doesn't depend on the events contained, but rather a simple increment index based on the order of the MELS as it appears amongst all MELS.

To fix element-hq/element-web#2916, force the checking of scroll position by calling _onWidgetLoad (might need renaming...) when a MELS is expanded/contracted.

Also use an keying scheme for MELS that doesn't depend on the events contained, but rather a simple incrementing index based on the order of the MELS as it appears amongst all MELS.
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

Isn't this going to cause similar problems? ie. I see a MELS (which gets index 0), I scroll a bit until another MELS comes into view (which gets index 1), I expand the one with index 1, scroll a bit more, the first one scroll off, the one with index 1 now becomes index 0 and therefore gets recreated and therefore unexpands?

I'm unsure of any way of getting a consistent expand-state here other than keeping track of what MELS each member event was put in, then making sure the MELS containing a given event always has a consistent key.

@lukebarnard1
Copy link
Contributor Author

lukebarnard1 commented Feb 20, 2017

Basing the key on the contained events will fail because of pagination. We can only optimise for events being paginated in/out (as with this PR), or new MELS being added by using an event ID.

If we want to optimise for both, we could control all MELS (by giving each MELS an expanded prop) from the component that contains them, but even then we'd need something to key-off of.

@lukebarnard1
Copy link
Contributor Author

Upon reflection, swapping to MELS-1,2,3 is not better than what we already have.

@lukebarnard1 lukebarnard1 assigned dbkr and unassigned lukebarnard1 Feb 22, 2017
@dbkr dbkr merged commit 8737112 into develop Feb 23, 2017
@lukebarnard1 lukebarnard1 deleted the luke/mels-scrolling-fix branch February 23, 2017 16:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants