Skip to content

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

Closed
@lindapaiste

Description

@lindapaiste

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),

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions