Skip to content

Add warning when using queryOptions to add a meta in <Edit> and <EditBase>#10882

Merged
fzaninotto merged 5 commits intomasterfrom
fix-edit-controller-meta
Aug 12, 2025
Merged

Add warning when using queryOptions to add a meta in <Edit> and <EditBase>#10882
fzaninotto merged 5 commits intomasterfrom
fix-edit-controller-meta

Conversation

@Madeorsk
Copy link
Contributor

@Madeorsk Madeorsk commented Aug 6, 2025

Problem

When providing a meta in the queryOption of an <Edit>, users must also provide it to the same mutationOptions. Otherwise, when disabling the redirection to the list, they might end up with the data not being updated correctly.

Solution

  1. Documentation
  2. Add a console log to warn the user when they use different meta in query options / mutation options and redirect false

One issue with the warning: it will be shown if users have a custom onSuccess where they redirect, but have redirect={false}.

How To Test

Story

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

const dataProvider = { getOne } as unknown as DataProvider;

render(
<CoreAdminContext dataProvider={dataProvider}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why you don't use your story here. This would avoid duplication.

@fzaninotto fzaninotto merged commit 4865cb6 into master Aug 12, 2025
15 checks passed
@fzaninotto fzaninotto deleted the fix-edit-controller-meta branch August 12, 2025 09:24
@fzaninotto fzaninotto added this to the 5.10.2 milestone Aug 12, 2025
@fzaninotto fzaninotto changed the title Fix edit controller meta Add warning when using queryOptions to add a meta in <Edit> and <EditBase>` Aug 12, 2025
@slax57 slax57 changed the title Add warning when using queryOptions to add a meta in <Edit> and <EditBase>` Add warning when using queryOptions to add a meta in <Edit> and <EditBase> Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Development

Successfully merging this pull request may close these issues.

2 participants