ref(forms): Migrate highlights settings#115778
Open
priscilawebdev wants to merge 3 commits into
Open
Conversation
Contributor
📊 Type Coverage Diff
🔍 3 new type safety issues introducedType assertions (
This is informational only and does not block the PR. |
8438cf1 to
e3f74f3
Compare
e3f74f3 to
0021112
Compare
0021112 to
ea42b1f
Compare
0bd5d8d to
26c9707
Compare
a631887 to
fb3d394
Compare
TkDodo
reviewed
May 20, 2026
| return {}; | ||
| } | ||
|
|
||
| return JSON.parse(highlightContext) as NonNullable<DetailedProject['highlightContext']>; |
Collaborator
There was a problem hiding this comment.
could we re-use the schema here instead of doing another manual JSON.parse ?
Member
Author
There was a problem hiding this comment.
Agreed in principle ....and I tried this. To re-use the schema we need AutoSaveForm to apply the transform on submit (so mutationFn receives the parsed output instead of the raw form value). This required a lot of changes in other files (PR is updated)... What is your take on this?
753c6de to
ecc4f1f
Compare
ecc4f1f to
cc24014
Compare
bf0dbd7 to
2ac4318
Compare
2ac4318 to
249df1e
Compare
TkDodo
approved these changes
May 20, 2026
Collaborator
There was a problem hiding this comment.
lots of unrelated formatting changes here
| `AutoSaveForm` keeps field state typed as the schema input, but submits the schema's parsed output to the mutation. This matches `useScrapsForm` and lets you use transforms or narrower output types without extra parsing in `mutationFn`. | ||
|
|
||
| > [!WARNING] | ||
| > The schema is applied to the form value on submit, so unknown keys are stripped per Zod's default behavior. For map-like fields with arbitrary keys, use `z.record(z.string(), …)` — not `z.object({})`, which declares zero keys and will strip everything at submit time. |
Collaborator
There was a problem hiding this comment.
we can also use passthrough to allow arbitrary values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the legacy highlights JsonForm with AutoSaveForm text areas for tags and context.
This keeps the existing autosave behavior, preserves the project cache updates,
and tightens the tests around the autosave requests.
closes https://linear.app/getsentry/issue/DE-1251/migrate-eventshighlightshighlightssettingsformtsx-from-legacy-form