mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 13:44:29 +08:00
fix: errors during word generation when custom text was empty
also migrate if an empty array was found in localstorage
This commit is contained in:
parent
b257a52f41
commit
b806179137
2 changed files with 6 additions and 1 deletions
|
|
@ -357,6 +357,11 @@ function apply(): void {
|
|||
|
||||
const text = cleanUpText();
|
||||
|
||||
if (text.length === 0) {
|
||||
Notifications.add("Text cannot be empty", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.customTextMode === "simple") {
|
||||
CustomText.setMode("repeat");
|
||||
state.customTextLimits.word = `${text.length}`;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const customTextLongLS = new LocalStorageWithSchema({
|
|||
});
|
||||
|
||||
export const CustomTextSettingsSchema = z.object({
|
||||
text: z.array(z.string()),
|
||||
text: z.array(z.string()).min(1),
|
||||
mode: CustomTextModeSchema,
|
||||
limit: z.object({ value: z.number(), mode: CustomTextLimitModeSchema }),
|
||||
pipeDelimiter: z.boolean(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue