Skip to content

Commit

Permalink
fix: readable().value should return latest value
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Jan 26, 2024
1 parent 4984ddc commit 6f89be6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Added toolbar config `placement: "left" | "right"` and `items: ToolbarItem[]` to further control the style of toolbar.
- Fixed `insertDocs()` on projector's static response not returning the correct `appId`.
- Fixed states like `camera.value` not returning the latest value when no one listens to it.

## 0.3.10

Expand Down
5 changes: 5 additions & 0 deletions packages/fastboard-core/src/utils/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export function readable<T>(value: T, start: StartStopNotifier<T> = noop): Reada
}
return {
get value() {
if (subscribers.size === 0) {
stop = start(set) || noop;
stop();
stop = undefined;
}
return value;
},
subscribe,
Expand Down

0 comments on commit 6f89be6

Please sign in to comment.