Skip to content

Commit

Permalink
[fix] initialContext is assigned the value of event.context
Browse files Browse the repository at this point in the history
  • Loading branch information
王泽龙 committed Sep 10, 2024
1 parent 5d9d604 commit 4e2d3db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/npm-fastui/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ interface EventDetails {
}

export function usePageEventListen(event?: PageEvent, initialContext: ContextType | null = null): EventDetails {
if (initialContext === null) {
if (event?.context !== null) {
initialContext = event?.context ?? null
}
}
const [eventContext, setEventContext] = useState<ContextType | null>(initialContext)
const [fireId, setFireId] = useState<string | null>(null)

Expand Down

0 comments on commit 4e2d3db

Please sign in to comment.