Closed sirjahames closed 11 months ago
There are some issues and concerns I have that need to be addressed before adding this function:
The name update()
is a bit overloaded in the context of this library and
could cause some confusion, a better name could be hydrate()
or apply()
.
What should the behavior be in the following case?
local label = Instance.new("TextLabel")
local countA = source(0)
local countB = source(100)
update(label) {
Text = countA
}
update(label) {
Text = countB
}
What are the use-cases for this function?
Currently create()
can accept an instance to clone and apply properties to
which serves the purpose of allowing us to use pre-made instances in the same
way as Vide-made instances and avoiding the issue in 2.
.`
I don't think we should officially have this function as part of the API because it can easily lead to antipatterns. You're supposed to create instances and side-effects to update properties only once, while this function lets you break this.
If you want to create side-effects to update properties of instances created outside of vide, you can easily do so with an effect()
call.
Adding the function listed in the title would be beneficial for development processes with vide.
update(instance: Instance)
Updates an existing instance by applying the properties and states passed.
Type
Details
Example