Skip to content

Commit fdddf7a

Browse files
committed
Fix import/export caching
1 parent 14f8f61 commit fdddf7a

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/TextEditor/SectionEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
}}
100100
>
101101
<IconPlus />
102-
Add Line
102+
Add line
103103
</button>
104104
</main>
105105

src/TextEditor/SideBarText.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@
5252
}
5353
json[key] = new Map(Object.entries(value as { [key: string]: [string, string] }));
5454
}
55+
const oldSection = section;
56+
section = null;
57+
// wait for the section to save before overwriting
58+
await new Promise((r) => setTimeout(r, 500));
5559
$textCache = { strings: json };
5660
importSuccess = true;
61+
section = oldSection;
5762
setTimeout(() => (importSuccess = false), 1000);
5863
};
5964
input.click();
@@ -129,7 +134,7 @@
129134
<IconDownload />
130135
Export Text as JSON
131136
</button>
132-
<button on:click={importText} style="color: var(--danger)">
137+
<button on:click={importText} style={importSuccess ? "" : "color: var(--danger)"}>
133138
{#if importSuccess}
134139
<IconCheck />
135140
Import successful!

0 commit comments

Comments
 (0)