Skip to content

Fix react 18 strict mode #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/mdx/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
reactStrictMode: true,
redirects() {
return [
{
Expand Down
12 changes: 6 additions & 6 deletions packages/mdx/src/mini-editor/editor-shift.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -793,21 +793,21 @@ function useSnapshots(

useLayoutEffect(() => {
if (!prevSnapshot) {
// debugger
const parent = ref.current!
setState(s => ({
...s,
prevSnapshot: {
...getPanelSnapshot(ref.current!, prev),
...getTabsSnapshot(ref.current!, prev),
...getPanelSnapshot(parent, prev),
...getTabsSnapshot(parent, prev),
},
}))
} else if (!nextSnapshot) {
// debugger
const parent = ref.current!
setState(s => ({
...s,
nextSnapshot: {
...getPanelSnapshot(ref.current!, next),
...getTabsSnapshot(ref.current!, next),
...getPanelSnapshot(parent, next),
...getTabsSnapshot(parent, next),
},
}))
}
Expand Down
2 changes: 1 addition & 1 deletion packages/mdx/src/smooth-code/copy-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function CopyButton({
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
strokeWidth="1.6px"
d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
/>
)}
Expand Down