Skip to content

fix: migrate from Svelte 4 lifecycle to Svelte 5#1013

Open
rohanshrma222 wants to merge 1 commit intoopenfoodfacts:mainfrom
rohanshrma222:Migrationissue
Open

fix: migrate from Svelte 4 lifecycle to Svelte 5#1013
rohanshrma222 wants to merge 1 commit intoopenfoodfacts:mainfrom
rohanshrma222:Migrationissue

Conversation

@rohanshrma222
Copy link

@rohanshrma222 rohanshrma222 commented Feb 26, 2026

Description

Migrate legacy onMount/onDestroy lifecycle hooks and on:click event
handlers to Svelte 5 syntax ($effect and onclick).

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Svelte 4 → 5 Migration (17 files)

  • Converted onMount to $effect in 17 files
  • Converted onDestroy cleanup to $effect return function
  • Converted on:click to onclick in NutritionCalculator.svelte
  • Added guards to prevent effects from running multiple times

Fixes #1000


Checklist:

Author Self-Review:

  • I have performed a self-review of my own code.
  • I understand the changes I'm proposing and why they are needed.
  • My changes generate no new warnings or errors (linting, console).
  • I have made corresponding changes to the documentation (if applicable).

LLM Usage Disclosure:
Please be transparent about the use of AI assistance.

  • If I did use an AI Large Language Model, I have reviewed the generated code/text to ensure its accuracy, security, and relevance to the project's context and licensing.

Triggering Code Review:

  • You can request an AI-powered code review by commenting /gemini review on this PR after it's been created.

@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explorer Ready Ready Preview, Comment Feb 26, 2026 3:41pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Incomplete Svelte 4 → 5 Migration: Legacy syntax still in use

1 participant