Skip to content

Fix Include Tag Descriptions toggle reverting on click#191

Merged
SlayterDev merged 4 commits into
mainfrom
copilot/fix-tag-description-toggle
Mar 13, 2026
Merged

Fix Include Tag Descriptions toggle reverting on click#191
SlayterDev merged 4 commits into
mainfrom
copilot/fix-tag-description-toggle

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

The "Include Tag Descriptions" toggle in Settings immediately reverted to off after being enabled. The handleUpdate function replaced optimistic state with the raw API response via setSettings(updated) — if the response contained stale data (e.g. from a race with fetchOllamaModels invoking a stale handleUpdate closure), the user's change was silently undone.

Changes

  • SettingsPage.tsxhandleUpdate: After a successful API call, merge the user's intended changes over the response rather than replacing state entirely:
// Before
setSettings(updated);

// After
if (updated) {
  setSettings({ ...updated, ...updates });
}
  • Null guard on updated: Prevents setSettings(undefined) from crashing the component when the API returns an empty body in unexpected scenarios.
Original prompt

Look at issue #185. Fix the issue with the tag description setting toggle.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

The handleUpdate function was calling setSettings(updated) with the raw API
response. If the API response contained stale/incorrect data (due to race
conditions like concurrent settings updates), the toggle would flip back to off.

Fix:
1. Merge user's intended changes into the API response: setSettings({...updated, ...updates})
   This ensures the toggle stays in the user's chosen state even if the API
   response has stale data from a concurrent update.
2. Add null check for the API response to prevent invalid state if the API
   unexpectedly returns nothing.

Co-authored-by: SlayterDev <1760134+SlayterDev@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with tag description setting toggle Fix Include Tag Descriptions toggle reverting on click Mar 3, 2026
@SlayterDev SlayterDev marked this pull request as ready for review March 12, 2026 21:20
@SlayterDev SlayterDev merged commit 8a612a8 into main Mar 13, 2026
2 checks passed
@SlayterDev SlayterDev deleted the copilot/fix-tag-description-toggle branch March 13, 2026 13:11
SlayterDev added a commit that referenced this pull request Mar 13, 2026
* Initial plan

* Fix tag description toggle: preserve user's change after API response

The handleUpdate function was calling setSettings(updated) with the raw API
response. If the API response contained stale/incorrect data (due to race
conditions like concurrent settings updates), the toggle would flip back to off.

Fix:
1. Merge user's intended changes into the API response: setSettings({...updated, ...updates})
   This ensures the toggle stays in the user's chosen state even if the API
   response has stale data from a concurrent update.
2. Add null check for the API response to prevent invalid state if the API
   unexpectedly returns nothing.

Co-authored-by: SlayterDev <1760134+SlayterDev@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: SlayterDev <1760134+SlayterDev@users.noreply.github.com>
Co-authored-by: Brad Slayter <SlayterDev@users.noreply.github.com>
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.

2 participants