Skip to content

Commit fdb2f5a

Browse files
author
Ives van Hoorne
committed
Fix current module resolving
1 parent b948e76 commit fdb2f5a

File tree

1 file changed

+17
-8
lines changed
  • packages/app/src/app/store/entities/sandboxes

1 file changed

+17
-8
lines changed

packages/app/src/app/store/entities/sandboxes/entity.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { schema } from 'normalizr';
33
import { getSandboxOptions } from 'common/url';
44

5-
import { findMainModule } from './modules/selectors';
5+
import { findMainModule, findCurrentModule } from './modules/selectors';
66
import moduleEntity from './modules/entity';
77
import directoryEntity from './directories/entity';
88
import userEntity from '../users/entity';
@@ -18,25 +18,34 @@ export default new schema.Entity(
1818
{
1919
processStrategy: sandbox => {
2020
const {
21-
currentModule = findMainModule(
22-
sandbox.modules,
23-
sandbox.directories,
24-
sandbox.entry
25-
),
21+
currentModule,
2622
initialPath,
2723
isInProjectView,
2824
isEditorScreen,
2925
isPreviewScreen,
3026
} = getSandboxOptions(document.location.href);
3127

28+
const mainModule = findMainModule(
29+
sandbox.modules,
30+
sandbox.directories,
31+
sandbox.entry
32+
);
33+
34+
const resolvedCurrentModule = findCurrentModule(
35+
sandbox.modules,
36+
sandbox.directories,
37+
currentModule,
38+
mainModule
39+
);
40+
3241
return {
3342
...sandbox,
3443
isInProjectView,
3544
showEditor: !isPreviewScreen,
3645
showPreview: !isEditorScreen,
37-
currentModule,
46+
currentModule: resolvedCurrentModule,
3847
initialPath,
39-
tabs: [currentModule]
48+
tabs: [resolvedCurrentModule]
4049
.filter(x => x)
4150
.map(m => ({ moduleId: m.id, dirty: true })),
4251
forcedRenders: 0, // used to force renders

0 commit comments

Comments
 (0)