Skip to content

Commit

Permalink
chore: site nit
Browse files Browse the repository at this point in the history
  • Loading branch information
prevwong committed May 21, 2021
1 parent dac1d4a commit 05d27f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions examples/landing/components/editor/Viewport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { Sidebar } from './Sidebar';
import { Toolbox } from './Toolbox';

export const Viewport: React.FC = ({ children }) => {
const { enabled, connectors, actions } = useEditor((state) => ({
const {
enabled,
connectors,
actions: { setOptions },
} = useEditor((state) => ({
enabled: state.options.enabled,
}));

Expand All @@ -26,12 +30,12 @@ export const Viewport: React.FC = ({ children }) => {
);

setTimeout(() => {
actions.setOptions((options) => {
setOptions((options) => {
options.enabled = true;
});
}, 200);
});
}, []);
}, [setOptions]);

return (
<div className="viewport">
Expand Down
4 changes: 2 additions & 2 deletions site/src/theme/Root.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useCallback, useEffect } from 'react';
import React, { useState, useCallback, useLayoutEffect } from 'react';
import { Route, Redirect, useLocation } from '@docusaurus/router';

import clsx from 'classnames';
Expand Down Expand Up @@ -26,7 +26,7 @@ function Root({ children }) {
});
}, []);

useEffect(() => {
useLayoutEffect(() => {
if (location.pathname !== '/') {
return;
}
Expand Down

0 comments on commit 05d27f3

Please sign in to comment.