Skip to content

Commit 5c1465b

Browse files
committed
Add memo to story
1 parent fad8b64 commit 5c1465b

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

packages/storybook/src/editor-spring.story.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,24 @@ function SingleEditor({
135135
}).then(code => setCode(code))
136136
}, [inputCode])
137137

138-
const step = {
139-
files: [
140-
{
141-
name: "index.js",
142-
code,
143-
focus,
144-
annotations,
138+
const step = React.useMemo(
139+
() => ({
140+
files: [
141+
{
142+
name: "index.js",
143+
code,
144+
focus,
145+
annotations,
146+
},
147+
],
148+
northPanel: {
149+
tabs: ["index.js"],
150+
active: "index.js",
151+
heightRatio: 1,
145152
},
146-
],
147-
northPanel: {
148-
tabs: ["index.js"],
149-
active: "index.js",
150-
heightRatio: 1,
151-
},
152-
}
153+
}),
154+
[code, focus]
155+
)
153156

154157
return code ? (
155158
<EditorSpring {...step} codeConfig={{ theme }} />

0 commit comments

Comments
 (0)