Skip to content

Commit 652bb58

Browse files
authored
Fix default opened files in parcel (codesandbox#3263)
1 parent 9eca915 commit 652bb58

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/app/src/app/overmind/internalActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ export const setCurrentSandbox: AsyncAction<Sandbox> = async (
183183
state.editor.mainModuleShortid = main.shortid;
184184

185185
// Only change the module shortid if it doesn't exist in the new sandbox
186-
// What is the scenario here?
186+
// This can happen when a sandbox is opened that's different from the current
187+
// sandbox, with completely different files
187188
if (
188189
!sandbox.modules.find(module => module.shortid === currentModuleShortid)
189190
) {

packages/common/src/templates/parcel.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ export class ParcelTemplate extends Template {
3131
* The file to open by the editor
3232
*/
3333
getDefaultOpenedFiles(configFiles) {
34-
const entries = [];
34+
let entries = [];
3535

3636
entries.push('/index.js');
3737
entries.push('/src/index.js');
38-
entries.concat(this.getEntries(configFiles));
38+
entries.push('/index.ts');
39+
entries.push('/src/index.ts');
40+
entries = entries.concat(this.getEntries(configFiles));
3941

4042
return entries;
4143
}

0 commit comments

Comments
 (0)