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

feat: set transitions as local #246

Merged
merged 1 commit into from
Jul 12, 2023
Merged

Conversation

peterpeterparker
Copy link
Member

@peterpeterparker peterpeterparker commented Jul 12, 2023

Motivation

Svelte transitions are executed by default in components regardless if their parent components destroy those or not. This behavior is known as the |global transitions setting and is the default in Svelte v3.

This leads to issue with the SvelteKit navigation because DOM elements might not be detached and related context might remain active.

We generally notice the issue in NNS dapp after navigation when the DOM wrongly contains two split-pane elements.

In Svelte v4 the default behavior was changed to |local. Setting that can already be used in v3 when explicitely set. This setting has for effect to not execute the transition and destroy the components if parents destroy those. i.e. to populate the destroy.

References

Changes

  • scope all transitions of Svelte to |local

Copy link
Contributor

@mstrasinskis mstrasinskis left a comment

Choose a reason for hiding this comment

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

Let's try! Thanks!

@peterpeterparker peterpeterparker merged commit 1eec2f4 into main Jul 12, 2023
7 checks passed
@peterpeterparker peterpeterparker deleted the feat/transitions-local branch July 12, 2023 07:26
github-merge-queue bot pushed a commit to dfinity/nns-dapp that referenced this pull request Jul 12, 2023
# Motivation

Svelte transitions are executed by default in components regardless if
their parent components destroy those or not. This behavior is known as
the `|global` transitions.

This leads NNS dapp to various issues in which components are not
destroyed and therefore, there context remains active.

Until today we solved this by applying a workaround in which we
destroyed the all layout in case of navigation. While it solved the
issue, this had for side effect to be a bit unpleasant for the eyes as
the all page layout disappeared on navigation.

By setting all the animation to `|local` we can solve the issue and make
the navigation more fluid.

# References

- documentation:
https://svelte.dev/docs/v4-migration-guide#transitions-are-local-by-default
- svelte issue: sveltejs/svelte#6686

# PRs

- [x] dfinity/gix-components#246

# Previous issues

- #1741
- #2861

# Changes

- update gix-cmp to set `|local` to any Svelte transitions
- set `|local` to the Svelte animations implemented in NNS dapp
- remove detail page layout navigating guard

# Notes

In the login page we will continue to observe `$navigating` because this
condition was not only used to solve the issue but, also to present a
spinner while the application is loading.
peterpeterparker pushed a commit that referenced this pull request Jul 13, 2023
# Motivation

Set svelte animation `local` to `global` because of broken `introend` event.

# PRs

- Revert #246

# Changes

- local to global everywhere

# Screenshots

No visual changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants