Skip to content

fix: get presets working correctly with dynamic params #17923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2025

Conversation

jaaydenh
Copy link
Contributor

@jaaydenh jaaydenh commented May 19, 2025

This adds a few fixes to get presets working correctly with dynamic params

  1. Changes to preset params need to be rendered and displayed correctly
  2. Changes to preset params need to be sent to the websocket
  3. Changes to preset params need to be marked as touched so they won't be automatically changed later because of dynamic defaults. Dynamic defaults means any default parameter value can be changed by the websocket response unless edited by the user, set by autofill or set by a preset.

@jaaydenh jaaydenh self-assigned this May 19, 2025
@jaaydenh jaaydenh requested a review from Emyrk May 19, 2025 20:46
Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly looks good, just had one concern. approving since it's a small thing so that you don't have to wait for me to re-review.

Comment on lines 241 to 244
return null;
}).filter(
(update): update is NonNullable<typeof update> => update !== null,
);
Copy link
Member

@aslilac aslilac May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use flatMap here instead of map and filter. just return [] or [x] instead of null and x. then we don't need the fancy annotations.

but even that's a bit "clever" for my taste. imho, ideally we'd leave it as a for loop and just have some result array that we push to when desired.

@jaaydenh jaaydenh merged commit dc21016 into main May 19, 2025
34 checks passed
@jaaydenh jaaydenh deleted the jaaydenh/dynamic-params-presets branch May 19, 2025 22:20
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants