Skip to content

Commit

Permalink
fix: filename index auto-increment (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sight-wcg authored Jul 8, 2023
1 parent a945563 commit 4f55810
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/editor/FileSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function startAddFile() {
while (true) {
let hasConflict = false
for (const file in store.state.files) {
if (file === name) {
for (const filename in store.state.files) {
if (stripSrcPrefix(filename) === name) {
hasConflict = true
name = `Comp${++i}.vue`
break
Expand Down
2 changes: 1 addition & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class ReplStore implements Store {
const exported: Record<string, string> = {}
for (const filename in this.state.files) {
const normalized =
filename === importMapFile ? filename : filename.replace(/^src\//, '')
filename === importMapFile ? filename : stripSrcPrefix(filename)
exported[normalized] = this.state.files[filename].code
}
return exported
Expand Down

0 comments on commit 4f55810

Please sign in to comment.