Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Super debug runed #589

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

Tyson910
Copy link
Contributor

@Tyson910 Tyson910 commented May 3, 2025

✅ Description

This PR addresses an issue when using Superforms in runes mode with Svelte 5, where an error is thrown due to the use of export let in the SuperDebug.svelte component:

SuperDebug.svelte:18:2 Cannot use export let in runes mode — use $props instead

The error occurs because Svelte 5's runes mode no longer allows export let syntax in components. Instead, $props() must be used.

To resolve this, I've introduced a conditional version of the SuperDebug component that supports runes mode in Svelte 5 while maintaining compatibility with Svelte 3/4.


🔍 Related Issue(s)

Fixes: Compatibility issue with SuperDebug.svelte in Svelte 5 runes mode

#568
#306
#426

Related discussion: Svelte 5 runes opt-in guide


📦 Changes Summary

  • Created SuperDebugRuned.svelte for Svelte 5 compatibility
  • Created SuperDebugLegacy.svelte component for Svelte 3/4
  • Rewrote SuperDebug.svelte to use SuperDebugLegacy.svelte or SuperDebugRuned.svelte based on Svelte version
  • Updated docs or usage references if needed (please confirm if needed)

🧪 How to Test

  1. In a Svelte 5 project using runes mode:

    • Enable runes mode globally
    • Use a form that triggers SuperDebug
    • Confirm no errors related to export let are thrown
  2. In a Svelte 4 project:

    • Use existing form setup
    • Confirm SuperDebug behaves as expected with no regressions

🧾 Checklist

  • I’ve tested my changes locally in Svelte 5 (runes mode)
  • I’ve tested my changes in a Svelte 4 project to ensure backward compatibility
  • I’ve run npm run lint and npm run check with no errors
  • I’ve followed the contributing guidelines

Copy link

vercel bot commented May 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
superforms ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 5, 2025 10:33pm

@ciscoheat
Copy link
Owner

Thank you so much for this upgrade! Is it ready to test?

@Tyson910
Copy link
Contributor Author

Tyson910 commented May 5, 2025

Not quite

Right now the TS is broken for the SuperDebug props. I believe using a $$Props should resolve the issue, but haven't had a chance to try it out yet

@Tyson910
Copy link
Contributor Author

Tyson910 commented May 5, 2025

Thank you so much for this upgrade! Is it ready to test?

@ciscoheat got TypeScript errors resolved, this is ready to test

@ciscoheat
Copy link
Owner

I got this when trying the PR locally:

Uncaught (in promise) Svelte error: state_unsafe_mutation
Updating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
https://svelte.dev/e/state_unsafe_mutation

	in SuperDebugRuned.svelte
	in SuperDebug.svelte
	in +page.svelte
	in +layout.svelte
	in +layout.svelte
	in root.svelte

    at state_unsafe_mutation (http://localhost:5173/node_modules/.vite/deps/chunk-YNIYXBDZ.js?v=25c419c5:295:19)
    at Module.set (http://localhost:5173/node_modules/.vite/deps/chunk-YNIYXBDZ.js?v=25c419c5:891:5)
    at http://localhost:5173/src/lib/client/SuperDebugRuned.svelte:567:35
    at update_reaction (http://localhost:5173/node_modules/.vite/deps/chunk-YNIYXBDZ.js?v=25c419c5:1778:23)
    at execute_derived (http://localhost:5173/node_modules/.vite/deps/chunk-YNIYXBDZ.js?v=25c419c5:1049:15)
    at update_derived (http://localhost:5173/node_modules/.vite/deps/chunk-YNIYXBDZ.js?v=25c419c5:1066:15)
    at Module.get (http://localhost:5173/node_modules/.vite/deps/chunk-YNIYXBDZ.js?v=25c419c5:2114:7)
    at consequent (http://localhost:5173/src/lib/client/SuperDebugRuned.svelte:569:6)
    at http://localhost:5173/node_modules/.vite/deps/chunk-LMV2IKFT.js?v=25c419c5:504:42
    at update_reaction (http://localhost:5173/node_modules/.vite/deps/chunk-YNIYXBDZ.js?v=25c419c5:1778:23)

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.

2 participants