Repository navigation
Confusing about Entity example #3666
JayMeDotDot
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm new to
gpui_kit, so when I read the docs, some examples confused me.In the official docs, this
Entityexample seems to express how anEntitynotifies an observer that data has been updated.But because clicking a button causes a re-render, the message displayed in
MessagePanelwill still be updated, even through I removed_subscriptionandcx.notifyin thethis.store.update.This makes it harder to keep the count at 0.
Maybe changing
let _subscription = cx.observe(&store, |_, _, cx| cx.notify());to
let _subscription = cx.observe(&store, |_, _, cx| { println!("Notified"); cx.notify() });will make this much better.
All reactions