-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
p5.js version
No response
What is your operating system?
Windows
Web browser and version
chrome://145.0.7632.117
Actual Behavior
In the collection creation form, the error handling logic for creating a new sketch collection is incomplete. The local state creationError is defined but never updated when the createCollection action fails.
When collection creation fails (e.g., due to a network error or backend validation failure), no error message is shown to the user because creationError remains undefined. The createCollection action dispatches an ERROR action on failure, but the component neither listens to this state nor catches the error.
Expected Behavior
The component should display an appropriate error message when collection creation fails.
This can be achieved either by:
-
reading the error state from Redux, or
-
modifying the action to return a rejected Promise so the component can catch it and set its local
creationErrorstate totrue.
Steps to reproduce
###Steps:
- Navigate to the Collection Creation page.
- Intercept the network request to the /collections endpoint and force it to fail (for example, return a 500 error).
- Attempt to create a collection.
- Observe that no error message is displayed despite the failure.
Snippet:
// TODO: error is never set!
// eslint-disable-next-line no-unused-vars
const [creationError, setCreationError] = useState();