marmelab / marmelab/react-admin
useCreate > onError returns callback function where error is "unknown"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 26.9k
- Forks
- 5.5k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 19
Description
**What you were expecting:**
onError should have callback function with same signature as useUpdate i.e. `(error: Error) => void` not `(error: unkonwn) => void)`
**What happened instead:**
Error needs to be casted only for some hooks
**Steps to reproduce:**
This is a useUpdate
This is a useCreate
**Environment**
* React-admin version: "^5.9.2"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the TypeScript definitions and implementation for the useCreate and useUpdate hooks, then compare the onError callback types shown in the reproduction. Verify the corrected useCreate signature with the reported React admin version and add or update coverage if the surrounding hook tests provide a suitable place; done means callers receive an Error without a cast.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100