Skip to content

Fix useCreate fails to update the cache when id equals 0#11199

Merged
slax57 merged 3 commits intomasterfrom
fix-updateCache
Mar 25, 2026
Merged

Fix useCreate fails to update the cache when id equals 0#11199
slax57 merged 3 commits intomasterfrom
fix-updateCache

Conversation

@ThieryMichel
Copy link
Copy Markdown
Contributor

Problem

When creating a resource with a numeric id for the first time, it's id will be 0, and updateCache will interpret this as no id, breaking the creation

Solution

Test for id being undefined or null specifically

How To Test

In storybook go to the new story: http://localhost:9010/?path=/story/ra-core-dataprovider-usecreate--create-id-zero

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@slax57 slax57 added this to the 5.14.5 milestone Mar 25, 2026
@slax57 slax57 merged commit 28f518c into master Mar 25, 2026
15 checks passed
@slax57 slax57 deleted the fix-updateCache branch March 25, 2026 10:41
@slax57 slax57 changed the title Fix update cache Fix useCreate fails to update the cache when id equals 0 Mar 25, 2026
@ThieryMichel ThieryMichel mentioned this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants