Skip to content

fix: device name change doesn't update immediately#645

Open
athospy wants to merge 1 commit into
commaai:masterfrom
athospy:fix/device-name-propagation
Open

fix: device name change doesn't update immediately#645
athospy wants to merge 1 commit into
commaai:masterfrom
athospy:fix/device-name-propagation

Conversation

@athospy

@athospy athospy commented Jun 25, 2026

Copy link
Copy Markdown

Fixes #641.

Root cause

ACTION_UPDATE_DEVICE updates state.devices[] but leaves state.device stale.
Components that read from state.device via Obstruction (e.g. DeviceInfo,
CommacareBadge) never see the new name until they remount — so renaming a device
appears to have no effect until a page reload.

ACTION_UPDATE_DEVICES (the bulk list refresh) already handles this correctly by
syncing state.device after updating the array. This applies the same pattern to
the single-device update action.

Fix

3 lines in src/reducers/globalState.js: after updating the device in state.devices[],
also update state.device if the updated device is the currently selected one.

When a device name is changed, ACTION_UPDATE_DEVICE updates state.devices[]
but left state.device stale. Components reading state.device (DeviceInfo,
CommacareBadge) would not re-render until remount, making the name change
appear to have no effect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Welcome to connect! Make sure to:

  • read the contributing guidelines
  • mark your PR as a draft until it's ready to review
  • post the preview on Discord; feedback from users will speedup the PR review

deployed preview: https://645.connect-d5y.pages.dev

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.

changing comma name doesn't propogate immediately

1 participant