Skip to content

Commit

Permalink
fix: better debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed May 29, 2022
1 parent 46bcaf0 commit db917a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,25 @@ function createStore({
// @TODO: flesh out the logic for when to notify react of state changes or not (as state updates can be expensive and we should be transient when possible)
// @TODO: put updateSnapshot actions in the state machine as declared events
// for now just re-render on every change and map out events in userland before abstracting them to the state machine
console.groupCollapsed('state.changed')
console.groupCollapsed('service.onTransition')
transient = state
console.log('transient', state.value, state.context)
console.log(state.value, state.context)
if (state.changed) {
if (unstable__requestAnimationFrame) {
cancelAnimationFrame(rAF)
rAF = requestAnimationFrame(() => {
console.group('onStoreChange')
console.log({ value: state.value, context: state.context })
console.log(state.value, state.context)
transient = snapshot = state
onStoreChange()
console.groupEnd()
})
} else {
console.group('onStoreChange')
console.log(state.value, state.context)
transient = snapshot = state
onStoreChange()
console.groupEnd()
}
}
console.groupEnd()
Expand Down

0 comments on commit db917a8

Please sign in to comment.