mirror of
https://github.com/littensy/charm.git
synced 2026-10-22 12:41:37 +00:00
feat!: run listen and subscribe callback in untracked
This commit is contained in:
parent
50afcaf6e9
commit
5c27052965
11 changed files with 28 additions and 156 deletions
|
|
@ -11,10 +11,7 @@ local Vide = require("./Vide")
|
|||
local function useSignalState<State>(getter: () -> State): () -> State
|
||||
local state = Vide.source(getter())
|
||||
|
||||
Vide.cleanup(Charm.effect(function()
|
||||
-- Wrap in untracked to avoid tracking inner effect and atom calls
|
||||
Charm.untracked(state :: (State) -> State, getter())
|
||||
end))
|
||||
Vide.cleanup(Charm.listen(getter, state))
|
||||
|
||||
return state
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue