Fixed async form loading#602
Merged
Merged
Conversation
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.
Summary
Fixes a bug where parameters from a previously-selected model leaked into a newly-added model when configuring an experiment, causing training to fail with schema validation errors (e.g.
DummyClassifierreceivingn_estimators,learning_rate). The bug only manifested in production builds because dev mode (HMR + Strict Mode) was masking the stale state.Type of Change
Changes (by file)
DashAI/front/src/hooks/useSchema.js: Reset the cachedmodelstate tonullat the start of the effect whenmodelNamechanges. Previously the hook kept the old schema while fetching the new one, sodefaultValuesreturned the previous model's params until the async fetch completed — if the user clicked "Add" quickly, those stale params were saved on the new model.DashAI/front/src/components/shared/FormSchemaDialog.jsx: Addedkey={modelToConfigure}toFormSchemaContainerso theFormSchemaProviderremounts when switching models in the edit dialog (matching the pattern already used inAddModelDialog). PreventsformValuesfrom carrying over between different models.Testing
Field requiredschema validation errors.Notes
The bug only reproduced in production builds because React Strict Mode and HMR in dev caused enough remounts to mask the stale-state issue. Worth keeping in mind for similar hooks that hold async-fetched state — clearing the cache when the input changes is safer than relying on the consumer to handle the transition.