Skip to content

Commit

Permalink
Adding tool for easier debugging of events
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceo committed Nov 27, 2024
1 parent 50275cf commit ee4ed18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/machines/search/debug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { InspectionEvent } from "xstate"

export const debugEvents = (inspectionEvent: InspectionEvent) => {
if (inspectionEvent.type === "@xstate.event") {
console.debug(inspectionEvent.event)
}
}
2 changes: 2 additions & 0 deletions lib/machines/search/useSearchMachineActor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const searchActor = createActor(searchMachine, {
searchPageSize: goConfig("search.item.limit"),
facetLimit: goConfig("search.facet.limit"),
},
// Uncomment this line to enable event debugging.
// inspect: debugEvents,
}).start()

// Administer search query params when filters are toggled.
Expand Down

0 comments on commit ee4ed18

Please sign in to comment.