-
Notifications
You must be signed in to change notification settings - Fork 3
Svelte v5 migrate #17
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
base: main
Are you sure you want to change the base?
Conversation
|
|
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.
Pull Request Overview
This PR migrates the application from Svelte v3 to v5 with updated dependency versions and syntax modernization. The migration refactors code structure by extracting the header component and updating event handling patterns while maintaining existing functionality.
- Upgrade to Svelte v5 syntax with new reactivity patterns (
$state
,$props
) - Update UI5 Web Components and build dependencies to latest versions
- Extract header functionality into separate component for better maintainability
Reviewed Changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
package.json | Update dependencies to Svelte v5 and latest UI5 Web Components |
vite.config.js | Remove splitVendorChunkPlugin from Vite configuration |
svelte.config.js | Migrate from svelte-preprocess to vitePreprocess |
eslint.config.js | Replace legacy ESLint configuration with flat config format |
src/main.ts | Update app mounting from constructor to mount function |
src/stores/stores.svelte.ts | Implement new reactive state management with Svelte v5 syntax |
src/lib/Header.svelte | Extract header component with theme and profile management |
src/lib/TodoList.svelte | Update props syntax and event handling for v5 compatibility |
src/lib/TodoItem.svelte | Convert to new props interface and event handler syntax |
src/App.svelte | Refactor main component using Header component and v5 patterns |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
done: boolean; | ||
}; | ||
|
||
class TodoStore<T extends TodoItemType> { |
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.
The TodoItemType
type is duplicated with TodoItemT
imported from the types file. Consider using the existing type instead of defining a duplicate.
class TodoStore<T extends TodoItemType> { | |
class TodoStore<T extends TodoItemT> { |
Copilot uses AI. Check for mistakes.
toggleDone(id: T["id"]) { | ||
const item = this.#todos.find((t) => t.id === id); | ||
|
||
console.log(item, id); |
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.
Debug console.log statement should be removed from production code.
console.log(item, id); |
Copilot uses AI. Check for mistakes.
add(newTodo: Pick<T, "deadline" | "desc">) { | ||
const item = { | ||
...newTodo, | ||
id: this.todos.length, |
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.
Using array length as ID can cause duplicate IDs when items are removed. This will assign ID 2 to a new item even if there's already an item with ID 2. Consider using a counter or finding the maximum existing ID + 1.
id: this.todos.length, | |
const maxId = this.todos.length > 0 ? Math.max(...this.todos.map(t => t.id)) : 0; | |
const item = { | |
...newTodo, | |
id: maxId + 1, |
Copilot uses AI. Check for mistakes.
</div> | ||
|
||
<div class="profile-settings-list"> | ||
<ui5-list selection-mode="Single" separators="None" onitem-click={handleProfileSettingsSelect} bind:this={profileSettingsPopover}> |
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.
The bind:this directive is binding to profileSettingsPopover
instead of a list reference variable. This should bind to a separate list variable.
<ui5-list selection-mode="Single" separators="None" onitem-click={handleProfileSettingsSelect} bind:this={profileSettingsPopover}> | |
<ui5-list selection-mode="Single" separators="None" onitem-click={handleProfileSettingsSelect} bind:this={profileSettingsList}> |
Copilot uses AI. Check for mistakes.
@ui5/webcomponents: 2.10.0
svelte: 5.30.1