mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
This commit is contained in:
parent
e776183452
commit
e35887f7d1
3 changed files with 23 additions and 27 deletions
|
|
@ -4,20 +4,20 @@ local create = require(script.Parent.create)
|
|||
local graph = require(script.Parent.graph)
|
||||
type Node<T> = graph.Node<T>
|
||||
local create_node = graph.create_node
|
||||
local get_stack_scope = graph.get_stack_scope
|
||||
local get_scope = graph.get_scope
|
||||
local open_scope = graph.open_scope
|
||||
local close_scope = graph.close_scope
|
||||
|
||||
local non_tracking_scope = create_node(false)
|
||||
|
||||
local function untrack<T>(source: () -> T): T
|
||||
local scope = get_stack_scope(1)
|
||||
local scope = get_scope()
|
||||
assert(scope)
|
||||
|
||||
open_scope(scope or non_tracking_scope)
|
||||
local effect = scope.effect
|
||||
scope.effect = false
|
||||
|
||||
local v = source()
|
||||
|
||||
close_scope()
|
||||
scope.effect = effect :: () -> ()
|
||||
|
||||
return v
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue