-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
After upgrading to the latest version of Svelte I was met with a bunch of Component was created without expected data property 'whatever'
errors that broke my application.
It is not a huge amount of work to set default values for the properties using the data()
method, but I personally liked that previously you could do things like this where your component can be hidden by default until you explicitly set({ show : true })
on it:
<div class="something{{ show ? ' show' : '' }}">Hello</div>
I find it convenient to not have to pass show="false"
when initializing the component. I think for an outsider coming to svelte for the first time they would expect it to work the same way as I did (any property you reference is treated as undefined
until you set a value to it) just cause that is how variable values and object properties work in javascript in general.
Anyway I think it would make sense to change this to a warning instead of breaking your whole application.