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

refactor: replace svelte/legacy run with for Svelte 5 migration #292

Conversation

joaobenedetmachado
Copy link

Description

This PR replaces all run calls from svelte/legacy with $effect and $derived as part of the Svelte 5 migration effort.
Related Issue

The issue

#255

So, i removed all imports from svelte/legacy, replaced all run() calls with $effect()

✅ Code passes all ESLint checks
✅ No browser console errors
✅ Maintained compatibility with existing features

Results

All functionality continues to work as expected after migrating to Svelte 5, with no new bugs or regressions introduced.

Copy link
Collaborator

@patrickskowronekdkfz patrickskowronekdkfz left a comment

Choose a reason for hiding this comment

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

Hey @joaobenedetmachado ,

thank you so much for your pull request and for taking the time to contribute to our open-source software! We really appreciate your effort in helping to improve the project.

The switch from Svelte 4 to Svelte 5 introduced the run functions, which work for now. However, some of your changes may have unintended side effects. Instead, we recommend using $derived to achieve the desired functionality.

We’re currently working on improving our testing process for external contributions, and your input is valuable to us! If you’d like, feel free to adjust your implementation based on this feedback. Also, just a quick note—please don’t modify the package-lock.json file for security reasons.

Thanks again for your contribution! Looking forward to your updates. 😊

@@ -619,7 +616,9 @@

addItemToQuery(queryItem, $activeQueryGroupIndex);
};
run(() => {

// Correto - usando $effect para executar um efeito colateral
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use English comments

@@ -187,13 +186,6 @@
item.criterion.description
?.toLowerCase()
.includes(clearedInputValue)

/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment is not related to the change to svelte 5. Please don't remove it!

@@ -249,12 +247,6 @@
item.name.toLowerCase().includes(clearedInputValue) ||
item.key.toLowerCase().includes(clearedInputValue) ||
item.description?.toLowerCase().includes(clearedInputValue)
/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment is not related to the change to svelte 5. Please don't remove it!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't touch package-lock.json

@@ -239,7 +237,7 @@
/**
* watches the input value and updates the input options
*/
run(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use $derived.by here instead of $effect: https://svelte.dev/docs/svelte/$effect#When-not-to-use-$effect

I think in all the other places we are writing to stores so we need to use $effect.

@timakro
Copy link
Collaborator

timakro commented Apr 3, 2025

Closing in favor of #320

@timakro timakro closed this Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants