Skip to content

Fix default-channel toggle in panel settings and protect the default channel#2563

Merged
glennjacobs merged 2 commits into
2.xfrom
fix/panel-channel-default-toggle
Jul 16, 2026
Merged

Fix default-channel toggle in panel settings and protect the default channel#2563
glennjacobs merged 2 commits into
2.xfrom
fix/panel-channel-default-toggle

Conversation

@glennjacobs

Copy link
Copy Markdown
Contributor

Summary

QA of the panel's Settings → Channels section surfaced one bug and one gap:

  • Bug — the default toggle did nothing. The shared Toggle component was written against radix-vue's old Switch API (:checked / @update:checked); reka-ui v2 renamed these to modelValue / update:modelValue, so the switch never emitted and default could never be changed from the create dialog or edit page. Fixed the binding (public on/toggle API unchanged) and added a component test so API drift fails loudly.
  • Gap — the default channel wasn't actually protected. The channels table hid the delete row action for the default channel, but the edit page and the core actions didn't enforce anything: the default channel could be deleted from its edit screen, and its default flag toggled off, leaving the store with no default channel.

Default-channel protection

  • DeleteChannel rejects the default channel (alongside the existing order-history guard).
  • UpdateChannel rejects unsetting default on the current default — the flag moves by promoting another channel, so a store with channels always has a default.
  • The panel edit page disables the delete button and locks the default toggle for the default channel, with explanatory tooltip/hint (Toggle gains a disabled prop); the controller maps both failures to translated flash messages as a backstop.
  • New strings translated in all 16 locales; spec 0049's channels section updated to record the rule.

Note: the legacy Filament admin doesn't route channel deletes through these core actions, so it can still delete a default channel — wiring its ChannelResource through DeletesChannel/UpdatesChannel would be a sensible follow-up.

Testing

  • Core: new unit tests for both guards; suite 949 passed.
  • Panel: new feature tests asserting the flash errors and unchanged records; suite 236 passed.
  • Frontend: new Toggle tests (emit on click, no emit when disabled, state rendering); vitest 38 passed, type-check and build clean.
  • PHPStan and Pint clean.

🤖 Generated with Claude Code

glennjacobs and others added 2 commits July 16, 2026 17:57
The shared Toggle component was written against radix-vue's old Switch
API (:checked / @update:checked); reka-ui v2 renamed these to
modelValue / update:modelValue, so clicking the switch never emitted
toggle. Channels was the only consumer, making it impossible to set a
channel as the default from the create dialog or edit page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ting

DeleteChannel now rejects the default channel (matching the row action
that already hid its delete button) and UpdateChannel rejects unsetting
the default flag — it moves by promoting another channel, so a store
with channels always has a default. The panel edit page disables the
delete button and default toggle accordingly (Toggle gains a disabled
prop), the controller maps both failures to translated flash messages,
and the new strings ship in all 16 locales.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to Todo in Roadmap Jul 16, 2026
@glennjacobs
glennjacobs merged commit cd9167b into 2.x Jul 16, 2026
23 checks passed
@glennjacobs
glennjacobs deleted the fix/panel-channel-default-toggle branch July 16, 2026 16:59
@github-project-automation github-project-automation Bot moved this from Todo to Done in Roadmap Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant