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

exposed field loading state #5704

Merged
merged 5 commits into from
Feb 12, 2024
Merged

Conversation

maryhipp
Copy link
Collaborator

@maryhipp maryhipp commented Feb 12, 2024

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Have you discussed this change with the InvokeAI team?

  • Yes
  • No, because:

Have you updated all relevant documentation?

  • Yes
  • No

Description

  • switches schema load from async thunk to RTK query
  • adds a loading state for exposed fields so it doesn't show "unknown field" until schema loads

Related Tickets & Documents

  • Related Issue #
  • Closes #

QA Instructions, Screenshots, Recordings

Merge Plan

Added/updated tests?

  • Yes
  • No : please replace this line with details on why tests
    have not been included

[optional] Are there any post deployment tasks we need to perform?

@github-actions github-actions bot added the frontend PRs that change frontend files label Feb 12, 2024
@maryhipp
Copy link
Collaborator Author

@psychedelicious this works well for me locally, but I am seeing an error in the console (screenshot below). Google tells me this is an RTK thing but I wasn't able to successfully debug it - maybe something I did wrong with error handling in the custom queryFn?

Screenshot 2024-02-12 at 2 55 55 PM

- Rely on RTK Query for the `loadSchema` query by providing a custom `jsonReplacer` in our `dynamicBaseQuery`, so we don't need to manage error state.
- Detect when the query was canceled and do not log the error message in those situations.
…s.getOpenAPISchema`

- Utilities is for server actions, move this to `appInfo` bc it fits better there.
- Rename to match convention for HTTP GET queries.
- Fix inverted logic in the `matchRejected` listener (typo'd this)
Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

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

Turns out matchRejected is fired for both failed and canceled requests, and you need to check the mysteriously named action.meta.condition to distinguish between those: https://redux-toolkit.js.org/api/createAsyncThunk#checking-if-a-promise-rejection-was-from-an-error-or-cancellation

Also I made a few small changes, see commits

@maryhipp maryhipp merged commit 25ce505 into main Feb 12, 2024
8 checks passed
@maryhipp maryhipp deleted the maryhipp/fix-exposed-field-loading-state branch February 12, 2024 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants