Skip to content

Collection details disappears for a moment when clicking "Add Sketch" #2250

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

Closed
lindapaiste opened this issue Jun 15, 2023 · 0 comments · Fixed by #2252
Closed

Collection details disappears for a moment when clicking "Add Sketch" #2250

lindapaiste opened this issue Jun 15, 2023 · 0 comments · Fixed by #2252
Labels

Comments

@lindapaiste
Copy link
Collaborator

p5.js version

No response

What is your operating system?

None

Web browser and version

No response

Actual Behavior

The collection name, description, etc. disappear for a moment and then come back when the "Add Sketch" modal is opened.

Expected Behavior

Opening the modal should not change the content behind it.

Steps to reproduce

Steps:

  1. Go to the collection details page for a collection that you own.
  2. Click "Add Sketch".

This is a result of having a single isLoading state for all API calls. While we are fetching the list of sketches, the code acts as if it is fetching the collection itself -- even though that API call already completed successfully.

It can be fixed by modifying some of these conditionals:

hasCollection() {
return !this.props.loading && this.props.collection != null;
}
hasCollectionItems() {
return this.hasCollection() && this.props.collection.items.length > 0;
}
_renderLoader() {
if (this.props.loading) return <Loader />;
return null;
}

There is no possibility that this.props.collection would be the wrong collection (ie. stale state from a previous collection view), as the selector looks specifically for the collection matching the provided collectionId.

collection: getCollection(state, ownProps.collectionId),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant