Skip to content

Commit

Permalink
Fix ssr build fail gatsbyjs/gatsby#29326, fix ssr build fail as React…
Browse files Browse the repository at this point in the history
… Quill use document.
  • Loading branch information
Raymans committed Aug 23, 2021
1 parent a291c23 commit 034c9a7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
25 changes: 17 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@ant-design/compatible": "^1.0.1",
"@ant-design/icons": "latest",
"@auth0/auth0-react": "^1.0.0",
"@babel/plugin-transform-spread": "^7.12.1",
"@fortawesome/fontawesome-svg-core": "^1.2.27",
"@fortawesome/free-brands-svg-icons": "^5.12.1",
"@fortawesome/free-solid-svg-icons": "^5.12.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Interviews/InterviewForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import AnchorSider from '../Sider/AnchorSider';
import { Option } from 'antd/lib/mentions';
import useGetStarted from '../../hooks/useGetStarted';
import useStore from '../../hooks/useStore';
import ReactQuill from 'react-quill';
import { ReactQuill } from '../../utils/ssrHelper';
import 'react-quill/dist/quill.snow.css';
import QuillHelpers from '../../utils/QuillHelpers';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Interviews/InterviewSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useAuth0 } from '@auth0/auth0-react';
import useApi from '../../hooks/useApi';
import ConfirmModal from '../Organization/ConfirmModal';
import useGetStarted from '../../hooks/useGetStarted';
import ReactQuill from 'react-quill';
import { ReactQuill } from '../../utils/ssrHelper';
import QuillHelpers from '../../utils/QuillHelpers';

const defaultInterviewSession = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import CustomBreadcrumb from '../CustomBreadcrumb';
import useApi from '../../hooks/useApi';
import Seo from '../Seo';
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
import ReactQuill from 'react-quill';
import { ReactQuill } from '../../utils/ssrHelper';
import QuillHelpers from '../../utils/QuillHelpers';

const FormItem = Form.Item;
Expand Down
7 changes: 6 additions & 1 deletion src/utils/ssrHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ let useLocalStorage = () =>

let aos = {};

let ReactQuill = {};

if (isBrowser) {
import('@rehooks/local-storage').then((module) => {
useLocalStorage = module;
});
import('aos').then((module) => {
aos = module;
});
import('react-quill').then((module) => {
ReactQuill = module;
});
}

export { aos, useLocalStorage };
export { aos, useLocalStorage, ReactQuill };

0 comments on commit 034c9a7

Please sign in to comment.