Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve optimistic update of datasetInfo #398

Merged
merged 1 commit into from
Jan 27, 2023

Conversation

JosephMarinier
Copy link
Contributor

@JosephMarinier JosephMarinier commented Jan 26, 2023

Description:

Improve optimistic update of datasetInfo. For example, if you update the project name in the config page (not yet possible), it will update instantly in the top navigation bar.

Checklist:

You should check all boxes before the PR is ready. If a box does not apply, check it to acknowledge it.

  • ISSUE NUMBER. You linked the issue number (Ex: Resolve #XXX).
  • PRE-COMMIT. You ran pre-commit on all commits, or else, you
    ran pre-commit run --all-files at the end.
  • USER CHANGES. The changes are added to CHANGELOG.md and the documentation, if they impact
    our users.
  • DEV CHANGES.
    • Update the documentation if this PR changes how to develop/launch on the app.
    • Update the README files and our wiki for any big design decisions, if relevant.
    • Add unit tests, docstrings, typing and comments for complex sections.

to reflect all fields from the config.
@@ -327,11 +327,20 @@ export const api = createApi({
);
const patchDatasetInfo = dispatch(
api.util.updateQueryData("getDatasetInfo", { jobId }, (draft) => {
if (partialConfig.name !== undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only validation needed? For example do you permit empty string as a value?

Copy link
Contributor Author

@JosephMarinier JosephMarinier Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I say we let the back end do the validation, so we don't duplicate the logic. In this case, I think it does allow for an empty string, yes.
This is not really validation, but rather "is it present in the partial config?". I would like to put "name" in partialConfig, but even though name: string is required in AzimuthConfig, in Partial<AzimuthConfig> it becomes name?: string | undefined, so I must deal with the undefined (even though it can't happen in our code).
Does that make sense?

@JosephMarinier JosephMarinier merged commit b569ca6 into main Jan 27, 2023
@JosephMarinier JosephMarinier deleted the joseph/improve-optimistic-update branch January 27, 2023 18:06
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.

2 participants