Skip to content

Commit

Permalink
fix(storybook): fix react doc generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Voisin committed Feb 21, 2024
1 parent 3fae8aa commit e10fba1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/libs/hooks/useFunctionOnce.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRef, useCallback } from 'react'

export default function useFunctionOnce(callback: (() => void) | undefined) {
function useFunctionOnce(callback: (() => void) | undefined) {
const hasRenderedOnce = useRef<boolean>(false)

return useCallback(() => {
Expand All @@ -10,3 +10,5 @@ export default function useFunctionOnce(callback: (() => void) | undefined) {
}
}, [callback])
}

export default useFunctionOnce
4 changes: 3 additions & 1 deletion src/libs/hooks/useIsMounted.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MutableRefObject, useEffect, useRef } from 'react'

export default function useIsMounted(): MutableRefObject<boolean> {
function useIsMounted(): MutableRefObject<boolean> {
const isMounted = useRef(false)

useEffect(() => {
Expand All @@ -12,3 +12,5 @@ export default function useIsMounted(): MutableRefObject<boolean> {

return isMounted
}

export default useIsMounted
4 changes: 3 additions & 1 deletion src/libs/hooks/useSafeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Dispatch, SetStateAction, useCallback, useState } from 'react'

import useIsMounted from './useIsMounted'

export default function useSafeState<State>(
function useSafeState<State>(
initialState: State | (() => State)
): [State, Dispatch<SetStateAction<State>>] {
const [state, setState] = useState(initialState)
Expand All @@ -29,3 +29,5 @@ export default function useSafeState<State>(

return [state, safeSetState]
}

export default useSafeState
7 changes: 3 additions & 4 deletions src/libs/itinerary/useOpenItinerary.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { useItinerary } from 'libs/itinerary/useItinerary'

export default function useOpenItinerary(
address?: string | null,
beforeNavigate?: () => Promise<void> | void
) {
function useOpenItinerary(address?: string | null, beforeNavigate?: () => Promise<void> | void) {
const { navigateTo } = useItinerary()

async function openItinerary() {
Expand All @@ -14,3 +11,5 @@ export default function useOpenItinerary(

return { openItinerary, canOpenItinerary: !!address }
}

export default useOpenItinerary

0 comments on commit e10fba1

Please sign in to comment.