-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
fix: use get
in constructor for deriveds
#15300
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 120aaa8 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 |
|
Hello, I think the Example here where |
Mh ..I wonder if it should actually be the opposite and we should also track reads to state inside the constructor...effectively you are reading state, why should we assume that you don't want that to be reactive (you can always untrack yourself but if we untrack for you you would have no way of preventing it) 🤔 |
I'm not sure about that, but personally I think that constructor should not be reactive on their own value... I think that's the reason for using |
I think it was made as an optimization but let me explore this a bit more |
I'd argue - the behavior shouldn't differ from the classless variant. Otherwise it will confuse people. |
I mean classes are already a bit different but I think I agree with this in this case: and I lean more towards this case because, again, if you want to untrack this by yourself you can, if we untrack for you you can't track it |
Closes #15288
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint