Skip to content

chore(ui/dashboard): replace watch() with getValues/useWatch in form handlers - #2586

Draft
steveninhle wants to merge 1 commit into
mainfrom
chore/fix-watch-subscriptions
Draft

chore(ui/dashboard): replace watch() with getValues/useWatch in form handlers#2586
steveninhle wants to merge 1 commit into
mainfrom
chore/fix-watch-subscriptions

Conversation

@steveninhle

Copy link
Copy Markdown
Collaborator

Summary

  • Replace inline watch() calls inside event handlers with getValues() in VariationsSwitch — eliminates 6 reactive subscriptions that only needed a point-in-time read
  • Combine duplicate watch('environmentId') calls into a single subscription in PushCreateUpdateModal
  • Replace watch('featureId') with useWatch in ExperimentCreateUpdateModal and ExperimentSettings to scope re-renders to only those components
  • Replace watch('variations') with useWatch in DefaultVariations for the same reason

Why

watch('field') called at the top level of a component (or inside a handler) registers a reactive subscription: every time that field changes, the entire component re-renders. In handlers, only the current value is needed — no subscription required. getValues() reads the value without subscribing. For render-time values that belong to a child/leaf component, useWatch confines the re-render to that component instead of bubbling it up to the parent.

@steveninhle steveninhle changed the title chore(ui): replace watch() with getValues/useWatch in form handlers chore(ui/dashboard): replace watch() with getValues/useWatch in form handlers May 28, 2026
@steveninhle
steveninhle force-pushed the chore/fix-watch-subscriptions branch from 282ef4e to b1234e8 Compare June 26, 2026 01:52
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.

1 participant