You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that just creating a new reference to a tree node is enough for getRefsResolvingTo() to return a Set with one Ref pointing to this tree node. My question is how can we destroy this ref?
In the Todo List example from the documentation about References, the reference to the selected Todo is somehow destroyed by setting selectedRef to undefined. But how to do that if the created Ref is not attached to a prop<Ref<Todo>> of an other model? It is possible to destroy directly the Ref itself?
The text was updated successfully, but these errors were encountered:
It is a custom ref that uses a context in resolve() to resolve the reference to the target model. This latter is in model store (a simple list of models).
In theory, as soon as the custom reference resolve function stops returning a resolved model (returns undefined) it should automatically be removed from the getRefsResolvingTo list.
Maybe you could add a blacklist in the context, make the custom ref return undefined when it is blacklisted and push something to that context blacklist when you want a ref to get "invalidated"?
Thank you for the explanations and the suggestion.
as soon as the custom reference resolve function stops returning a resolved model (returns undefined) it should automatically be removed from the getRefsResolvingTo list.
It seems that just creating a new reference to a tree node is enough for
getRefsResolvingTo()
to return a Set with one Ref pointing to this tree node. My question is how can we destroy this ref?In the Todo List example from the documentation about References, the reference to the selected Todo is somehow destroyed by setting
selectedRef
toundefined
. But how to do that if the created Ref is not attached to aprop<Ref<Todo>>
of an other model? It is possible to destroy directly the Ref itself?The text was updated successfully, but these errors were encountered: