Skip to content

Populate modelInput with sim result input - #597

Merged
lars-petter-hauge merged 1 commit into
mainfrom
populate_input_sim_results
Dec 2, 2025
Merged

Populate modelInput with sim result input#597
lars-petter-hauge merged 1 commit into
mainfrom
populate_input_sim_results

Conversation

@lars-petter-hauge

@lars-petter-hauge lars-petter-hauge commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

solves: #596

fixes concentrations, but not parameters, those are slightly more tricky

Will not interfere with any of the input concentrations from other models

@lars-petter-hauge
lars-petter-hauge force-pushed the populate_input_sim_results branch from de407c5 to 90bff06 Compare December 1, 2025 15:03
@lars-petter-hauge

Copy link
Copy Markdown
Collaborator Author

quick view
https://github.com/user-attachments/assets/83008b50-fc71-4e12-9830-b981a213292a

it seems as if going back and forth works, but it doesn't. As can be seen when using the same model (the results are updated, but not the input):

Screen.Recording.2025-12-01.at.16.36.38.mov

When we use refresh however, it works:

Screen.Recording.2025-12-01.at.16.37.45.mov

quick extra to show parameters changing and adding components:

Screen.Recording.2025-12-01.at.16.28.19.mov

@lars-petter-hauge

Copy link
Copy Markdown
Collaborator Author

but going to the url works quite well, so perhaps it's more about making the "back" and "forward" update url correctly.

@lars-petter-hauge

Copy link
Copy Markdown
Collaborator Author

tried handling this with using key attribute to a larger degree:

        inputsStep = models.map((model) => {
            const isCurrentModel = model.modelId === currentModel?.modelId;

            const defaultConcentrations = isCurrentModel ? simulationResults?.modelInput?.concentrations : undefined;
            const defaultParameters = isCurrentModel ? simulationResults?.modelInput?.parameters : undefined;

            return (
                <ModelInputs
                    key={`${model.modelId}-${JSON.stringify(defaultConcentrations)}-${JSON.stringify(defaultParameters)}`}
                    model={model}
                    visible={isCurrentModel}
                    onSubmit={(concentrations, parameters) =>
                        setModelInput({ modelId: model.modelId, concentrations, parameters })
                    }
                    defaultConcentrations={defaultConcentrations}
                    defaultParameters={defaultParameters}
                />
            );
        });

but getting issue where when a user press run, the numbers in the input form goes back to default values, before resetting to simulation results when the result is retrieved..

(also all input models all of a sudden has the same concentrations (eg invalid components are listed..))

@lars-petter-hauge
lars-petter-hauge merged commit 4ef6b0b into main Dec 2, 2025
7 checks passed
@lars-petter-hauge
lars-petter-hauge deleted the populate_input_sim_results branch December 2, 2025 11:56
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