Skip to content

Commit

Permalink
fix(ssr): missing print and localStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Oct 11, 2022
1 parent 4580385 commit 6bafcfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/components/src/Resume.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export const Resume = (props: ResumeProps) => {
templateContextProps,
} = props

const [dark, setDark] = useState(localStorage.getItem(RESUME_THEME_KEY) === 'dark')
const [dark, setDark] = useState(false)

useEffect(() => {
setDark(localStorage.getItem(RESUME_THEME_KEY) === 'dark')
}, [])

useEffect(() => {
props.onDarkClass?.('dark', dark ? 'add' : 'remove')
Expand Down
2 changes: 1 addition & 1 deletion packages/template/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface TemplateContextProps {

const context = createContext<TemplateContextProps>({
toggleTheme: noop,
print,
print: noop,
})

context.displayName = 'TemplateContext'
Expand Down

1 comment on commit 6bafcfd

@vercel
Copy link

@vercel vercel bot commented on 6bafcfd Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

resume – ./

resume-dengqing.vercel.app
resumejs.vercel.app
resume-git-main-dengqing.vercel.app
resume.todev.cc

Please sign in to comment.