Skip to content

Commit ba17d84

Browse files
committed
support dev builds of livestore
1 parent 000e679 commit ba17d84

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.changeset/hip-areas-ask.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@effect-atom/atom-livestore": patch
3+
---
4+
5+
support dev builds of livestore

packages/atom-livestore/src/AtomLivestore.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ export const Tag = <Self>() =>
9696
const store = get(self.store)
9797
return Result.map(store, (store) => {
9898
const q = typeof query === "function" ? query(get) : query
99+
function onUpdate(value: A) {
100+
get.setSelf(Result.success(value))
101+
}
102+
onUpdate.onUpdate = onUpdate
99103
get.addFinalizer(
100-
store.subscribe(q, {
101-
onUpdate(value) {
102-
get.setSelf(Result.success(value))
103-
}
104-
})
104+
store.subscribe(q, onUpdate)
105105
)
106106
return store.query(q)
107107
})
@@ -113,12 +113,12 @@ export const Tag = <Self>() =>
113113
return undefined
114114
}
115115
const q = typeof query === "function" ? query(get) : query
116+
function onUpdate(value: A) {
117+
get.setSelf(value)
118+
}
119+
onUpdate.onUpdate = onUpdate
116120
get.addFinalizer(
117-
store.subscribe(q, {
118-
onUpdate(value) {
119-
get.setSelf(value)
120-
}
121-
})
121+
store.subscribe(q, onUpdate)
122122
)
123123
return store.query(q)
124124
})

0 commit comments

Comments
 (0)