Skip to content

Commit

Permalink
fix: crash by navigating to a font slice if the fonts slice has no font
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaSimonePorceddu committed Nov 1, 2021
1 parent e860a3a commit cdce5df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Detail: React.FC<Props> = ({ main = 'fonts' }) => {
const themeFonts = useThemeSlice('fonts')

const firstFont = useMemo(() => {
const fontArray = Object.keys(themeFonts)
const fontArray = Object.keys(themeFonts || {})
return fontArray[0] as Font
}, [themeFonts])

Expand Down
2 changes: 1 addition & 1 deletion devtool/src/_shared/components/Slices/Fonts/General.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ItemCard: React.FC<ItemProps> = ({ property, value }) => {
const themeFonts = useTheme().fonts;

const firstFont = useMemo(() => {
const fontArray = Object.keys(themeFonts)
const fontArray = Object.keys(themeFonts || {})
return fontArray[0] as keyof Fonts
}, [themeFonts])

Expand Down

0 comments on commit cdce5df

Please sign in to comment.