fix: switch a Select Tab component's tab when its default value changes

Merged
BU
1d ago
+9-1

What does this PR do?

In the low-code app editor, a Select Tab component ignores a change to its Default Value once a tab is selected. Set the Default Value to "bar" and the Bar tab is selected; change it to "foo" and Bar stays selected.

The effect that applies the default read selected === '' && resolvedConfig.defaultValue. Once a tab is selected, && stops at the first operand, so the default was never read and never tracked. This PR drops that guard, so the effect tracks the default on its own, as Select Step does. One file, AppSelectTab.svelte, 2 lines added and 1 removed.

Reproduced on main at 3cc8b20 (backend CE v1.875.0).

flowchart TD
    A[Builder changes the Default Value of a Select Tab] --> B{Selected tab}
    B -->|Before| C[Stays on the tab picked by the old default]
    B -->|After| D[Switches to the tab the new default names]

Narrated recording, before then after (sound on):

https://github.com/user-attachments/assets/c5ed4fd3-7699-41ff-85cf-5091f8f7b38a

The recording is the real app (frontend dev server from this checkout against the main backend image). Waits on page loads are shortened; nothing else is edited.

Edge cases and unchanged behaviour checked

All checked in the running app, on this branch:

  • Default Value set three times in a row, to "bar", "foo" then "bar", selects the matching tab each time.
  • After a tab is clicked by hand, a new Default Value still selects its tab (a third tab added, Default Value "value" selects it).
  • Unchanged: with no Default Value, a new Select Tab starts with no tab selected.
  • Unchanged: a tab clicked by hand stays selected; the existing default does not pull it back.

Checks run

  • npm run lint (oxlint): passes.
  • prettier --check on the changed file: the lines changed here are formatted; the file already fails the check on main because of three unrelated long lines, which this PR leaves alone.
  • Not run: npm run check (svelte-check needs about 8 GB here) and npm run check:fast (no bun on this machine).
  • No test added: docs/validation.md asks for none on pure UI changes.

Related issue

None filed. Found while building a low-code app with a Select Tab component.

AI tools (Claude Code) assisted with this change; the bug was reproduced on main and the fix verified in the running app as shown.

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes the low-code editor's Select Tab component so changing its Default Value switches the selected tab, even after a tab has been selected.

Previously, the effect that applied the default was gated on an empty selection, so once a user picked a tab, the default was never re-read and a new Default Value was ignored. The effect now tracks the default on its own: if no tab is selected, or the new default matches one of the tabs, the tab switches. A new default that doesn't match any tab leaves the current selection intact. Behavior when no default is set, and manual tab clicks, is unchanged.