Skip to content

Commit ae4d8a2

Browse files
siddharthkpCompuIves
authored andcommitted
Make react client views mutable (codesandbox#2377)
1 parent 39c5296 commit ae4d8a2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/common/src/templates/template.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import immer from 'immer';
2-
31
import { absolute } from '../utils/path';
42
import {
53
ConfigurationFile,
@@ -68,6 +66,10 @@ const CLIENT_VIEWS: ViewConfig[] = [
6866
},
6967
];
7068

69+
// React sandboxes have an additional devtool on top of CLIENT_VIEWS
70+
const REACT_CLIENT_VIEWS: ViewConfig[] = [...CLIENT_VIEWS];
71+
REACT_CLIENT_VIEWS[1].views.push({ id: 'codesandbox.react-devtools' });
72+
7173
const SERVER_VIEWS: ViewConfig[] = [
7274
{
7375
views: [{ id: 'codesandbox.browser' }],
@@ -204,10 +206,9 @@ export default class Template {
204206
configurationFiles.package &&
205207
configurationFiles.package.parsed &&
206208
configurationFiles.package.parsed.dependencies;
209+
207210
if (dependencies && dependencies.react) {
208-
return immer(CLIENT_VIEWS, draft => {
209-
draft[1].views.push({ id: 'codesandbox.react-devtools' });
210-
});
211+
return REACT_CLIENT_VIEWS;
211212
}
212213

213214
return CLIENT_VIEWS;

0 commit comments

Comments
 (0)