mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.
Prevent personal instructions drafts from being overwritten by delayed
query results. Block editing until instructions load, show initial-load
errors distinctly from empty prompts, and preserve dirty edits during
later query updates.
Reset successful saves from the server response and cache it before
refetching so a failed refresh cannot restore stale instructions.
Includes behavioral tests and loading, error, and empty Storybook
states.
Reproduction:
1. The user already has a nonempty saved personal-instructions prompt.
2. Open settings with the initial GET delayed.
3. Type a new draft into the enabled textarea.
4. The GET returns the existing saved prompt.
5. Formik replaces the draft with that prompt.
6. Further typing and Save submit the saved prompt plus subsequent
edits, losing the original draft.
<details>
<summary>Implementation decisions</summary>
- Keep Formik reinitialization for initial hydration and pristine
updates, guarded by the existing personal-model form draft pattern.
- Use the confirmed mutation response as the clean form baseline and
cache value.
- Leave the existing Saved-indicator behavior unchanged; no additional
retry UI.
</details>