-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat: make fallback prop values readonly #9789
Conversation
🦋 Changeset detectedLatest commit: 23064b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/svelte/tests/runtime-runes/samples/proxy-prop-default-readonly/_config.js
Outdated
Show resolved
Hide resolved
@@ -1422,13 +1423,14 @@ export function is_store(val) { | |||
export function prop_source(props_obj, key, flags, default_value) { |
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.
I'm starting to think it might make more sense to have two versions of this – one for runes and one for legacy. I'm really unhappy that we have sync_effect
as it's an anti-pattern, so if we can somehow get to a point where we kill that in runes, it enables us to make forking of effects work. With sync effects that happen during the notification phase, that's pretty much impossible as it means effects fire and potentially invalidate another effect tree, making forking impossible.
@Rich-Harris, FYI this breaks my previously working code where I am intentionally passing settable values down into my component as normal setter functions, and based on the docs and my prior knowledge of Svelte. I cannot understand how to fix this new error. <script lang="ts">
import type { ITodo } from "./createApp.svelte";
// ...
const { todo } = $props<{
todo: ITodo;
}>();
</script>
...
<input
type="text"
class="grow"
bind:value={todo.text}
bind:this={todo.htmlInputElement}> But, this will break with these changes. So, there are two things: I don't understand how to set this up in a different way. Separately, this seems like an amazing opportunity to add something to the error message that mentions the name being accessed, since Webkit/JavaScriptCore throws away the original stack trace of the error in report_error, making this incredibly challenging to track down |
Am I correct to understand that the fix is to simply mark the users with bind like
|
Can you provide a REPL link with code that you think is broken now? In general, with this change, you have to use |
@dummdidumm - I was able to make my code work in this way: colelawrence/here-now@073acd5#diff-8f574d4bbd38fcef4678b28158a9d7b504178716321ea7fc7f8a97ea2fec0e38R78 I think the idea is fine given that this all works together, but I would strongly suggest adding a clearer runtime error message to help the developer find and fix the issue.
Or something similar. Here's a link to the logic that no longer works. I'm not sure if it's a result of this exact PR or another recent PR related to this. |
Thanks for the reproducible - this should work, it's a bug that it doesn't. Will open a PR to fix this. |
closes #9763
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint