Skip to content

fix: preserve row id in meta - #6925

Merged
BatuhanW merged 5 commits into
refinedev:mainfrom
pokycookie:fix/audit-meta-id
Sep 2, 2025
Merged

fix: preserve row id in meta#6925
BatuhanW merged 5 commits into
refinedev:mainfrom
pokycookie:fix/audit-meta-id

Conversation

@pokycookie

@pokycookie pokycookie commented Aug 9, 2025

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

When editing a row inside an Edit page, the audit log payload’s meta.id reflects the Edit page’s route id (e.g. 6) instead of the edited row id (e.g. 1). This is reproducible with the sample in the issue.

Root cause: In audit logging, the meta object is composed such that route/context meta (including id) is spread after the explicit id/ids, which overrides the intended row id.

What is the new behavior?

Adjust the meta composition order in audit logging so explicit id/ids take precedence over the combined meta from route/context.

Changes:

  • useCreate: meta is now { ...rest, dataProviderName, id }
  • useUpdate: meta is now { ...rest, dataProviderName, id }
  • useDelete: meta is now { ...rest, dataProviderName, id }
  • useUpdateMany: meta is now { ...rest, dataProviderName, ids }

This keeps the rest of the application behavior intact, only affecting the audit log payload.

fixes #6906

Notes for reviewers

  • Touched files:

    • packages/core/src/hooks/data/useCreate.ts
    • packages/core/src/hooks/data/useUpdate.ts
    • packages/core/src/hooks/data/useDelete.ts
    • packages/core/src/hooks/data/useUpdateMany.ts
  • Tests

    • packages/core/src/hooks/data/useCreate.spec.tsx
    • packages/core/src/hooks/data/useUpdate.spec.tsx
    • packages/core/src/hooks/data/useDelete.spec.tsx
    • packages/core/src/hooks/data/useUpdateMany.spec.tsx

(before)
image

(after)
image

@changeset-bot

changeset-bot Bot commented Aug 9, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 86dd86c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Aug 9, 2025

Copy link
Copy Markdown

Deploy Preview for refine-doc-live-previews ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 86dd86c
🔍 Latest deploy log https://app.netlify.com/projects/refine-doc-live-previews/deploys/68b6c2f05e2f9c0008455678
😎 Deploy Preview https://deploy-preview-6925--refine-doc-live-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pokycookie
pokycookie marked this pull request as ready for review August 10, 2025 15:01
@pokycookie
pokycookie requested a review from a team as a code owner August 10, 2025 15:01
@BatuhanW

BatuhanW commented Sep 2, 2025

Copy link
Copy Markdown
Member

Hi @pokycookie thanks for the PR. Can you add patch changeset? You can see our contributing guide here.

@BatuhanW BatuhanW left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @pokycookie thanks for the PR.

Don't forget to add changesets next time.

https://refine.dev/docs/guides-concepts/contributing/

@BatuhanW
BatuhanW merged commit 5a3e404 into refinedev:main Sep 2, 2025
5 checks passed
@joanaavelar

Copy link
Copy Markdown

Hi @BatuhanW,

Do you know when a new released will be launched with this fix?

@pokycookie

Copy link
Copy Markdown
Contributor Author

Hi @BatuhanW, Thanks for the review and merge!

I’m sorry I missed the changeset. This was my first contribution to refine.
I have read the contributing guide and I will include a patch changeset next time. I appreciate you handling it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - The audit meta id is not reflecting the id of the editable table when the editable table is inside an Edit Page.

4 participants