Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
xcarpentier committed Jul 4, 2022
1 parent 60ee76c commit 7cf6e84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/TourGuideContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface Emitter {
}
export type Ctx<T extends any> = Record<string, T> & { _default: T }

export type ITourGuideContext = {
export interface ITourGuideContext {
setTourKey?: (tourKey: string) => void
eventEmitter?: Ctx<Emitter>
canStart: Ctx<boolean>
Expand Down
10 changes: 7 additions & 3 deletions src/hooks/useTourGuideController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export const useTourGuideController = (tourKey?: string) => {
const { start, canStart, stop, eventEmitter, getCurrentStep, setTourKey } =
React.useContext(TourGuideContext)

let key = tourKey ?? '_default'
const key = tourKey ?? '_default'

const _start = (fromStep?: number) => {
setTourKey && setTourKey(key)
if (setTourKey) {
setTourKey(key)
}
if (start) {
start(key, fromStep)
}
Expand All @@ -33,7 +35,9 @@ export const useTourGuideController = (tourKey?: string) => {
}

React.useEffect(() => {
setTourKey && setTourKey(key)
if (setTourKey) {
setTourKey(key)
}
}, [])

const KeyedTourGuideZone: React.FC<Omit<TourGuideZoneProps, 'tourKey'>> =
Expand Down

0 comments on commit 7cf6e84

Please sign in to comment.