Comments (4)
Yup definitely a bug: my guess is that name is not detected as being updatable (if you look at the generated code is not a source is just a variable). Probably a missing "branch" when checking for variables that are updated.
from svelte.
In case anyone needs a temporary fix, and using $: isn't an option (because the reactive re-assignment breaks something). This allows the initial value to be set based on a prop, so that it won't be updated when the prop changes but any assignment to value will trigger updates (I think, I'm still experimenting to find what works with both versions):
export let prop
let initial = prop // and likely some other logic
$: value = initial
from svelte.
In case anyone needs a temporary fix, and using $: isn't an option (because the reactive re-assignment breaks something). This allows the initial value to be set based on a prop, so that it won't be updated when the prop changes but any assignment to value will trigger updates (I think, I'm still experimenting to find what works with both versions):
export let prop let initial = prop // and likely some other logic $: value = initial
You just need to reassign that variable in another place, a listener or even just this
<script>
let display = 'none'
$: display = display;
function action(div) {
display = 'block'
}
</script>
<div style:display use:action>Hello</div>
from svelte.
I'll give that a try - I could well have been over-thinking things!
from svelte.
Related Issues (20)
- ReferenceError: Request is not defined on launch HOT 1
- Svelte 5: add examples of mixing runes and store to documention HOT 4
- In class syntax, you cannot create non-reactive variables. HOT 3
- docs: svelte 5 event handler pass variables? HOT 2
- Svelte 5: Tell if a bindable prop is actually passed using bind HOT 4
- Bad error message on `svelte:window`
- Spread props with functions wonβt work HOT 1
- Update being skipped in slot HOT 2
- VS Code: The Svelte server crashed 5 times. Cannot find module @rollup/rollup-win32-x64-msvc HOT 8
- ReactiveMap and ReactiveSet has no value in log HOT 1
- SVGs with animateTransform lag for an extremely long time when embedded HOT 7
- Transitions are present before delay is reached HOT 1
- Writing an import statement inside the markup as document content makes Svelte process it HOT 4
- missing type of HTMLAttribute HOT 4
- Svelte 5: Add warning to compiler when using `bind:value` incorrectly HOT 2
- Svelte 5 migrate function throws if there's no semicolon at the end of a reactive statement
- Svelte 5: Chrome: svelte-select list is not opened on the first click (same code of Svelte 4) HOT 21
- Option to extends components HOT 2
- `remove_input_attr_defaults` function is slow during hydration HOT 5
- Svelte 5: restrict which characters can be used in component props HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte.