Skip to content

Commit e46411d

Browse files
authored
Merge pull request #173 from code-hike/fix-react-18-strict-mode
Fix react 18 strict mode
2 parents 4baae11 + 8c6fd0a commit e46411d

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

packages/mdx/next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
reactStrictMode: true,
23
redirects() {
34
return [
45
{

packages/mdx/src/mini-editor/editor-shift.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -793,21 +793,21 @@ function useSnapshots(
793793

794794
useLayoutEffect(() => {
795795
if (!prevSnapshot) {
796-
// debugger
796+
const parent = ref.current!
797797
setState(s => ({
798798
...s,
799799
prevSnapshot: {
800-
...getPanelSnapshot(ref.current!, prev),
801-
...getTabsSnapshot(ref.current!, prev),
800+
...getPanelSnapshot(parent, prev),
801+
...getTabsSnapshot(parent, prev),
802802
},
803803
}))
804804
} else if (!nextSnapshot) {
805-
// debugger
805+
const parent = ref.current!
806806
setState(s => ({
807807
...s,
808808
nextSnapshot: {
809-
...getPanelSnapshot(ref.current!, next),
810-
...getTabsSnapshot(ref.current!, next),
809+
...getPanelSnapshot(parent, next),
810+
...getTabsSnapshot(parent, next),
811811
},
812812
}))
813813
}

packages/mdx/src/smooth-code/copy-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function CopyButton({
4343
<path
4444
strokeLinecap="round"
4545
strokeLinejoin="round"
46-
strokeWidth="2"
46+
strokeWidth="1.6px"
4747
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"
4848
/>
4949
)}

0 commit comments

Comments
 (0)