Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Commit

Permalink
fix(docz): remove config conditional from hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Mar 13, 2019
1 parent 3f5b5d7 commit 6b6f134
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/docz/src/hooks/useDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { doczState, Entry } from '../state'
import { compare } from '../utils/helpers'

export const useDocs = (): Entry[] | null => {
const { entries, config } = useContext(doczState.context)
if (!entries || !config) return null
const { entries } = useContext(doczState.context)
if (!entries) return null
const arr = entries.map(({ value }) => value)
return sort(arr, (a: Entry, b: Entry) => compare(a.name, b.name))
}
2 changes: 1 addition & 1 deletion core/docz/src/hooks/useMenus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export interface UseMenusParams {
export const useMenus = (opts?: UseMenusParams) => {
const { query = '' } = opts || {}
const { entries, config } = useContext(doczState.context)
if (!entries || !config) return null
if (!entries) return null

const arr = entries.map(({ value }) => value)
const entriesMenu = menusFromEntries(arr)
Expand Down

0 comments on commit 6b6f134

Please sign in to comment.