Skip to content

Auto-refresh Settings device list after enable/disable#111

Merged
HamptonMakes merged 1 commit into
mainfrom
05-13-auto-refresh_device_list_on_settings_after_enable_disable
May 13, 2026
Merged

Auto-refresh Settings device list after enable/disable#111
HamptonMakes merged 1 commit into
mainfrom
05-13-auto-refresh_device_list_on_settings_after_enable_disable

Conversation

@HamptonMakes
Copy link
Copy Markdown
Collaborator

Why

When you click "Enable on this device" on the Settings page, the buttons update but the Devices receiving notifications list doesn't reflect the new browser until you reload the page. Same on disable.

Hampton hit this end-to-end:

when I re-enabled in Settings (it showed enabled, but not subscribed?!?) it kinda updated the buttons automatically, but I had to refresh to see the browser listed for updates below.

How

  • Extracts the device list into _devices.html.erb wrapped in a <turbo-frame id="web-push-devices">.
  • Adds GET /web_push/devices that re-renders the partial inside the same frame.
  • web_push_settings_controller.js: new devicesUrl Stimulus value; after enable/disable success, sets the frame's src to refetch.

No new dependencies, no broadcasts — Turbo Frame does the work.

Verification

  • 834 specs pass (8 in the existing web_push/subscriptions_spec.rb still green; controller addition is the new devices action and the partial extraction is behavior-preserving on the initial page render).
  • Manual: enable on Settings → row appears; disable → row disappears; both without a page reload.

Generated with Amp

Wraps the per-device list in a turbo-frame and reloads it from the
Stimulus controller after subscribe/unsubscribe succeeds, so the new
browser appears (or disappears) without a full page refresh.

Changes
- Extracts the device list into _devices.html.erb wrapped in a
  <turbo-frame id=web-push-devices>.
- Adds GET /web_push/devices that renders just that partial back into
  the same frame.
- web_push_settings_controller.js: new devicesUrl Stimulus value;
  after enable/disable success, sets the frame's src to refetch.

Generated with Amp
@HamptonMakes HamptonMakes merged commit b3c7255 into main May 13, 2026
5 checks passed
@HamptonMakes HamptonMakes deleted the 05-13-auto-refresh_device_list_on_settings_after_enable_disable branch May 13, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant