- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.1k
 
fix: avoid warning for non reactive property in generated root #12484
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: avoid warning for non reactive property in generated root #12484
Conversation
          🦋 Changeset detectedLatest commit: eaf1730 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  | 
    
| 
           Mmm there are a bunch of unrelated tests failing   | 
    
          
 Yeah, unfortunately the tests have been flaky for a long time. However, I think we just had a breakthrough on that front. I just sent #12487 to fix one of the main ones that's been failing. I wouldn't worry about the failing tests all that much, but you can rebase against   | 
    
          
 Just merged back   | 
    
| 
           Also @benmccann does my test make sense or should i remove it if we don't run tests in svelte 5 yet?  | 
    
| 
           I use the term rebase out of habit, but merging main as you did is probably better. We just merged a couple more flaky test fixes, so you might want to do it once more I'll let Rich and Simon do the actual review on this PR since they're the Svelte 5 experts  | 
    
          
 Thanks...merged main back again.  | 
    
| 
           If I try this fix out locally it changes nothing, the warning still appears - which makes sense IMO because the validation isn't depending on whether or not something is   | 
    
          
 Uh weird it was working for me... My reasoning was that this PR sveltejs/svelte#12484 made so that non-bindable props are not reactive even if there's a default value so i thought that adding  
 Ok so basically we don't need this to be state because we are not actually reacting to it, we are just using   | 
    
| 
           There's currently no way to ignore runtime warnings - we would need to add that capability  | 
    
          
 Ohhh right it's a runtime warning. IMHO while the warning is fine there cases to bind to a non reactive variable (if I just want to use that variable only in JS and not react to it). I'll try to take a look later but I think at this point this can be closed since most likely we need to do something in svelte  | 
    
| 
           I mean in this specific case we could just avoid transforming   | 
    
          
 @dummdidumm i got this working for this specific warning...do you think is worth a PR or should i find a more general approach?  | 
    
          
 I mean it was already implemented and we can always close so....why not 😄  | 
    
| 
           Closing in favor of the referenced issue/PR  | 
    
Closes sveltejs/svelte#12514
Since the new version of svelte 5 props are not reactive by default and only if wrapped in
$bindable()so the generated root.svelte file was throwing this warning (and now that i think of it it might also cause some bug when thecomponentsactually changes...even tho looking at where they are used is always in an$effectwithconstructorsso in theory whenevercomponentschangesconstructorsshould also change)I've added a test for this but i don't know if it's actually needed and also currently is passing even before the change because the tests seems to run with svelte 4 (and i don't see a way to run them with svelte 5). I can remove it if needed.
Also also if
componentsreally don't need to be reactive should we just silence the warning instead (and remove them from the effect)?Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits