Skip to content

Commit c0b73ba

Browse files
authored
feat: save variable/resource even with validation errors (#4798)
Closes #4753 Variable validation especially resources shouldn't be too destructive. User may configure complex resource and get it all wiped out because url is invalid or header has empty value. Here I tweaked the logic to require only not duplicated "name" and everything else is saved even when invalid. This will not break anything in generation process and will still show user an error. <img width="649" alt="Screenshot 2025-01-28 at 14 18 11" src="https://github.com/user-attachments/assets/0916d250-a864-4362-bf1f-67b6c15024ef" />
1 parent 6b04c97 commit c0b73ba

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

apps/builder/app/builder/features/settings-panel/variable-popover.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,14 @@ export const VariablePopoverTrigger = ({
813813
if (requiresUpgrade) {
814814
return;
815815
}
816-
if (event.currentTarget.checkValidity()) {
816+
const nameElement =
817+
event.currentTarget.elements.namedItem("name");
818+
// make sure only name is valid and allow to save everything else
819+
// to avoid loosing complex configuration when closed accidentally
820+
if (
821+
nameElement instanceof HTMLInputElement &&
822+
nameElement.checkValidity()
823+
) {
817824
const formData = new FormData(event.currentTarget);
818825
panelRef.current?.save(formData);
819826
// close popover whenever new variable is created

apps/builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@lexical/selection": "^0.21.0",
3939
"@lexical/utils": "^0.21.0",
4040
"@lezer/common": "^1.2.3",
41-
"@lezer/css": "^1.1.9",
41+
"@lezer/css": "^1.1.10",
4242
"@lezer/highlight": "^1.2.1",
4343
"@nanostores/react": "^0.8.0",
4444
"@nkzw/use-relative-time": "^1.1.0",

packages/design-system/src/components/floating-panel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export const FloatingPanel = ({
158158
width={width}
159159
height={height}
160160
{...position}
161+
aria-describedby={undefined}
161162
onInteractOutside={(event) => {
162163
// When a dialog is centered, we don't want to close it when clicking outside
163164
// This allows having inline and left positioned dialogs open at the same time as a centered dialog,

pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)