-
Notifications
You must be signed in to change notification settings - Fork 8
feat!: Migrate Back
button to Svelte 5
#631
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Back
button to Svelte 5Back
button to Svelte 5
yhabib
reviewed
May 15, 2025
yhabib
reviewed
May 15, 2025
yhabib
reviewed
May 16, 2025
yhabib
approved these changes
May 16, 2025
AntonioVentilii
added a commit
that referenced
this pull request
May 17, 2025
# Motivation According to [Svelte 5 documentation](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Event-modifiers), with the migration, the event modifiers are deprecated and should be replaced by functions that have the same scope. For example, instead of: ```svelte <button on:click|preventDefault={handler}>...</button> ``` One should do ```svelte <script> function preventDefault(fn) { return function (event) { event.preventDefault(); fn.call(this, event); }; } </script> <button onclick={once(preventDefault(handler))}>...</button> ``` In this PR we create the `stopPropagation` util, to help with the migration (it will be used in other PR, like #631). # Changes - Creating a new type for event handlers. - Creating new util for stop propagation, based on the Svelte documentation. - Export new event-modifiers util modules. # Screenshots Created new tests, including a mock component. --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
@yhabib @peterpeterparker ready for another review pls |
peterpeterparker
approved these changes
May 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx 👍
You can edit the description of the PR, the change "Create util to replicate even..." can notably be removed now.
LGTM , thanks |
AntonioVentilii
added a commit
to dfinity/eslint-config-oisy-wallet
that referenced
this pull request
May 19, 2025
# Motivation We introduce Svelte lint rule [prefer-const](https://sveltejs.github.io/eslint-plugin-svelte/rules/prefer-const/), that warns about unnecessary mutable variables in Svelte components. In Svelte 5, some variables are defined using runes. By default the runes excluded by this lint rule are `$props` and `$derived`. However, we decided (see [thread](dfinity/gix-components#631 (comment))) to leave mutable variables when they are defined by `$state`. So we exclude it from the rule too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Migrating component Back button to Svelte 5.
Changes
Back
component, usingstopPropagation
wrapper.Header
component: it will need to dispatch the old eventnnsBack
. We will remove it when we migrate it to Svelte 5.Screenshots
Current tests are sufficient.