Skip to content

Commit

Permalink
Merge pull request #155 from CrispyBacon1999/fix-published-topics
Browse files Browse the repository at this point in the history
fix(useNTState): Publish topic when created with useNTState
  • Loading branch information
CrispyBacon1999 authored Mar 4, 2024
2 parents d548f91 + 8aec02c commit 558fecb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/useNTState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const useNTState = <T extends NTTopicTypes>(
const clientTopic = client.createTopic(key, ntType, defaultValue);
setTopic(clientTopic);
const subscriptionUID = clientTopic.subscribe(listener);
clientTopic.publish();

return () => {
if (subscriptionUID && clientTopic) {
Expand Down

0 comments on commit 558fecb

Please sign in to comment.