Skip to content
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

Crossfade page transitions not clearing prior page #4363

Closed
JohnRSim opened this issue Feb 4, 2020 · 12 comments
Closed

Crossfade page transitions not clearing prior page #4363

JohnRSim opened this issue Feb 4, 2020 · 12 comments
Labels
awaiting submitter needs a reproduction, or clarification

Comments

@JohnRSim
Copy link

JohnRSim commented Feb 4, 2020

Describe the bug
The prior page during crossfade transition is not cleared when service workers/caching is enabled if you interact between pages during the crossfade animation transition period.
This creates overlapping pages - attached screenshot below.
It is possible to create multiple overlapping pages that have not been correctly cleared.

If service workers/cache is disabled then I am unable to replicate the issue and the transitions work fine from my mobile.

Using Chrome Version 79.0.3945.130

Following the page transition guide by @buhrmi
https://dev.to/buhrmi/svelte-component-transitions-5ie

Logs
n/a no error logs

To Reproduce
Enable service workers and use the following-
https://dev.to/buhrmi/svelte-component-transitions-5ie
make sure cache is enabled and you have not selected disable cache within developer tools.

Expected behavior
The page transition / crossfade from page to page should know the landing page and check to confirm it has correctly cleared the prior page.

Stacktraces
n/a

Information about your Svelte project:
Chrome 79.0.3945.130
Win10
Svelte/Sapper - 3.17.0/0.27.9
Rollup

Severity
Minor

Additional context
n/a

c4b6ada9-097d-4e42-abab-1a78f4537c20

image

You can see here two <section pages are listed there should only be one left after the transition.

@JohnRSim
Copy link
Author

JohnRSim commented Feb 4, 2020

https://vimeo.com/389240441

  • here is a quick video where you can see at the end the issue with the crossfade if I click during the animation cycle.

The prior DOM page is not cleared.

@JohnRSim
Copy link
Author

JohnRSim commented Feb 4, 2020

image
Quick screenshot showing the issue in browser.

@Conduitry
Copy link
Member

There's not much anyone can do to help or debug if there's not a (preferably minimal) repo that can be cloned to reproduce this.

@JohnRSim
Copy link
Author

JohnRSim commented Feb 4, 2020

Working on it ;)

@JohnRSim
Copy link
Author

JohnRSim commented Feb 4, 2020

@Conduitry here is cut down simplified version of the issue -
https://github.com/JohnRSim/CrossfadeTransitionIssue

Created a basic example based off
https://dev.to/buhrmi/svelte-component-transitions-5ie

Issue is here with setTimeout
https://github.com/JohnRSim/CrossfadeTransitionIssue/blob/master/src/routes/about.svelte

Is the best approach to use on:introstart to clear the timers?
Prior I had them set within the onDestroy but realise now this is not triggered.

@JohnRSim JohnRSim changed the title Crossfade page transitions not clearing prior page with cache and service workers enabled on mobile. Crossfade page transitions not clearing prior page Feb 4, 2020
@JohnRSim
Copy link
Author

JohnRSim commented Feb 5, 2020

I've tried removing timeouts and adding the delay on the fades - still getting the duplication of pages when history.back initiated during the transition.

@JohnRSim
Copy link
Author

JohnRSim commented Feb 5, 2020

I've cleaned up the sample and located the issue.

An Ajax request was updating the data on the DOM during the page transition back.
Crossfade does then not remove the prior page.

I've replaced the ajax request with timeout - where dummydata var is being updated in the repo
https://github.com/JohnRSim/CrossfadeTransitionIssue/blob/master/src/routes/about.svelte

I think this is a bug

  • I can fix the issue by clearing the timeout during the crossfade page transition or killing the fetch request with the AbortController API..

@antony
Copy link
Member

antony commented Apr 9, 2020

I think this is the same bug (or related to #3202 and #3685) - there are known issues with transitions and route changes (unmounting components).

Using |localon your transitions can fix a lot of these. Can you see if that works?

  • not denying the issue here at all, just wondering what our default mode should be.

@antony antony added awaiting submitter needs a reproduction, or clarification and removed question labels Apr 9, 2020
@JohnRSim
Copy link
Author

I will give it a go this morning and let you know.

@JohnRSim
Copy link
Author

@antony I added |local the crossfade page transition fadein/out worked as prior however the element transition set with out:send,in:receive stopped working.

@Conduitry
Copy link
Member

Is this fixed in 3.21.0, which fixes several other similar transition issues?

@antony
Copy link
Member

antony commented Oct 3, 2020

Confirming that the repro provided in the original issue works with the current version of Svelte:

 ant@apse  /home/ant/Projects/CrossfadeTransitionIssue   master ✘ ✹  npm ls svelte                                                                                                            22:33:29 
altas@0.0.2 /home/ant/Projects/CrossfadeTransitionIssue
└── svelte@3.29.0 

💯 🥳

@antony antony closed this as completed Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification
Projects
None yet
Development

No branches or pull requests

4 participants