Reapply "ref(dynamic-sampling): Migrate organizationSampling to new form system (#109356)"#111612
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| }); | ||
| addSuccessMessage(t('Changes applied.')); | ||
| setSavedTargetSampleRate(value.targetSampleRate); | ||
| formApi.reset(value); |
There was a problem hiding this comment.
Dual source of truth causes stale UI after save
Medium Severity
After a successful save, savedTargetSampleRate is set from the user's raw input (e.g., "30"), but the org store update causes initialTargetSampleRate to be recomputed as (0.3 * 100).toString(), which yields "30.000000000000004" due to IEEE 754 floating-point arithmetic. Because TanStack Form's defaultValues are reactive, the form's current value gets overwritten with the floating-point-noisy string. This causes showPreviousValue (targetSampleRate !== savedTargetSampleRate) to evaluate true incorrectly, displaying a spurious "previous value" indicator and a noisy number in the input. Affects common rates like 10%, 20%, 30%, 60%, 70%.


This reverts commit 73dde1f.