mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
changes
This commit is contained in:
@@ -201,7 +201,10 @@ const RuleEngineFormDialog = ({
|
||||
const payload: Record<string, unknown> = {};
|
||||
|
||||
for (const field of visibleFields) {
|
||||
const raw = values[field.name];
|
||||
// Derived fields always submit their computed value — never stale state.
|
||||
const raw = field.computeValue
|
||||
? (field.computeValue(values) ?? "")
|
||||
: values[field.name];
|
||||
if (field.type === "multiselect") {
|
||||
// Always the full replacement list — the API syncs the relation to it.
|
||||
payload[field.name] = Array.isArray(raw) ? raw : [];
|
||||
@@ -348,6 +351,7 @@ const RuleEngineFormDialog = ({
|
||||
}
|
||||
|
||||
const isNumber = field.type === "number";
|
||||
const computed = field.computeValue ? field.computeValue(values) : undefined;
|
||||
|
||||
return (
|
||||
<TextInput
|
||||
@@ -359,7 +363,8 @@ const RuleEngineFormDialog = ({
|
||||
// display order) is a non-negative magnitude — reject negatives outright
|
||||
// rather than letting a typed "-" reach the API.
|
||||
min={isNumber ? 0 : undefined}
|
||||
value={String(values[field.name] ?? "")}
|
||||
disabled={field.disabled || computed !== undefined}
|
||||
value={String((computed !== undefined ? computed : values[field.name]) ?? "")}
|
||||
onChange={(e) => {
|
||||
const next = e.currentTarget.value;
|
||||
if (isNumber && next.trim().startsWith("-")) return;
|
||||
|
||||
Reference in New Issue
Block a user