Skip to content

Comments

Fix required dimensions component to read/write formik state properly#1783

Open
shangyian wants to merge 2 commits intoDataJunction:mainfrom
shangyian:ui-required-dims-bug
Open

Fix required dimensions component to read/write formik state properly#1783
shangyian wants to merge 2 commits intoDataJunction:mainfrom
shangyian:ui-required-dims-bug

Conversation

@shangyian
Copy link
Collaborator

Summary

This PR fixes an issue where required dimensions get removed when editing a metric node from the UI. The issue comes from an uncontrolled formik field state. The setup before only set the initial display value, but didn't sync state with Formik unless the user interacted with the component. That meant that the form could submit with undefined if the field was never touched.

With this change, it always reads from field.value (aka formik's state), so it's synced with formik at all times and the form will submit the current value.

This fixes the bug for this flow:

  1. Form initializes with existing required_dimensions
  2. User edits query (doesn't touch required dims)
  3. Form submits with correct required_dimensions value
  4. Backend receives the field and preserves it

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

@netlify
Copy link

netlify bot commented Feb 23, 2026

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 2297957
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/699c38005ed0f9000830eecf

@shangyian shangyian force-pushed the ui-required-dims-bug branch 2 times, most recently from 01deee1 to 1f34d7a Compare February 23, 2026 11:13
@shangyian shangyian marked this pull request as ready for review February 23, 2026 11:13
@shangyian shangyian force-pushed the ui-required-dims-bug branch from 1f34d7a to a9b043d Compare February 23, 2026 11:18
@shangyian shangyian force-pushed the ui-required-dims-bug branch from a9b043d to 2297957 Compare February 23, 2026 11:20
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