-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Preact Components not unmounting due to InstantClick page lifecycle events. #11458
Comments
Thanks for the issue! We'll take your request into consideration and follow up if we decide to tackle this issue. To our amazing contributors: issues labeled To claim an issue to work on, please leave a comment. If you've claimed the issue and need help, please ping @forem/oss and we will follow up within 3 business days. For full info on how to contribute, please check out our contributors guide. |
@nickytonline is there a solution to this in the pipeline? I see the pull request you submitted was closed for more thought. |
My initial try for this kind of worked. I need to dig into this more still. Also other things took priority, so this completely fell off my radar. 😅 @cmgorton, this would be good to add to the next cycle work. |
Hey @Link2Twenty, no, it's not currently prioritised. I noticed the two bugs referenced by this issue have been closed - do you know if this behaviour is causing bugs in the live app at the moment? I'm just thinking it might be helpful to reframe this issue around unwanted behaviours in production, so we can see what priority level it should be. |
OK great - thank you @Link2Twenty! Checking the notes on #11371 now it seems like we closed it in favour of this issue, but then this issue was never fully resolved 🙃 I'll update the description here and add the |
Describe the bug
This can manifest itself in different ways, but a good example is the home feed keyboard navigation. Every time you leave the home screen and come back the keyboard shortcuts stack meaning the next button (
J
), which should advance by 1, advances by 2, 3 or n posts per click.Previous investigation showed that the problem is that Preact components are not properly unmounting when a user leaves the page, due to InstantClick behaviour.
Previous notes from Nick:
I know how to fix it @reobin. I will create an issue and put a PR up for it. We need to explicitly call
unmountComponentAtNode
in anInstantClick.on('change', () => {})
event. This is something that normally we wouldn't have to do, but because we use InstantClick, it's necessary. It also explains why I saw components repeated in the Preact dev tools.I need to do it for pretty much all out components that get mounted via
render
. e.g.To Reproduce
This will be having effects in multiple places that might not be quite so visible, but as above, you can see the impact on the home page.
j
key to go to the next post - verify it steps through posts one by onej
to go to the next post in the feed - notice it 'skips' a postn
posts depending how many times you have navigated to/from the feedExpected behavior
Preact components should be unmounted when an InstantClick even changes the page.
In the example above this would mean
j
always advances one post at a time, regardless of previous navigation.Screenshots
See #11458 (comment)
The text was updated successfully, but these errors were encountered: