UPDATE: Adds name validation and exposes it in wasm
We do a trick I am not proud of. Because all of our errors are Strings, we don't have a way to separate a name error from an index error, for instance. What I do in prepend the error with a string that indicates where it comes from.
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
3db094c956
commit
1391f196b5
@@ -83,7 +83,7 @@ function EditNamedRange({
|
||||
} else {
|
||||
// Check for duplicates only if format is valid
|
||||
const scopeIndex = worksheets.findIndex((s) => s.name === scope);
|
||||
const newScope = scopeIndex >= 0 ? scopeIndex : null;
|
||||
const newScope = scopeIndex >= 0 ? scopeIndex : undefined;
|
||||
const existing = definedNameList.find(
|
||||
(dn) =>
|
||||
dn.name === trimmed &&
|
||||
@@ -99,6 +99,7 @@ function EditNamedRange({
|
||||
}
|
||||
|
||||
setNameError(error);
|
||||
setFormulaError("");
|
||||
}, [name, scope, definedNameList, editingDefinedName, worksheets]);
|
||||
|
||||
const hasAnyError = nameError !== "" || formulaError !== "";
|
||||
|
||||
Reference in New Issue
Block a user