chore: Migrate galactic-sovereign-frontend to Svelte 5 #26
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.
Work
Background
Svelte released their V5 back in April and after letting a bit of time pass it seems like a good time to migrate to this new version.
They prepared a migration guide which goes over the main changes. Notably this version brings a new way to handle reactivity. There's also a migration script available.
How did we do it?
We just used the script they provided.
How did it go?
The outcome was encouraging but we had a couple of cases where a
<table>
did not contain a<tbody>
. There's a lengthy discussion whether this is actually good or not (see issue 9785) but in our case it does not matter too much and we fixed it.We also have a couple of legacy behavior that the script did not manage to convert. This includes code in the
StyledActionButton
and in the overview and buildings page.As this PR is already quite big we will tackle those in a follow-up.
Update:
StyledActionButton
legacy usage was fixed in 8c72c12.Tests
Running the code locally still works as expected.
Future work
We also need to migrate the user-dashboard project.
Additionally a couple of improvements to the readability could be done (explaining the replacement pattern for images and apply prettier as a
Makefile
target): this was done in e7ff297.