marmelab / marmelab/react-admin

useCreate > onError returns callback function where error is "unknown"

Open
#11,262 3 comments 0 reactions 0 assignees View on GitHub

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
Image

This is a useCreate

Image

**Environment**

* React-admin version: "^5.9.2"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.