Skip to content

fix(utils): build query withDeleted remove auto detection - #12788

Merged
kodiakhq[bot] merged 8 commits into
developfrom
fix/with-deleted-detection
Jun 25, 2025
Merged

fix(utils): build query withDeleted remove auto detection#12788
kodiakhq[bot] merged 8 commits into
developfrom
fix/with-deleted-detection

Conversation

@adrien2p

@adrien2p adrien2p commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

What
Currently, filtering data providing a deleted_at value will automatically apply the withDeleted flag which in turns remove the default constraint apply to all queries deleted_at: null. The problem is that it does not account for the value assign to deleted_at leading to inconsistent behaviour depending on the value. e.g filtering with deleted_at: { $eq: null } where the expectation is to only filter the non deleted record will end up returning deleted record as well by applying the withDeleted filters.

This pr revert this auto detection if favor of the user providing withDeleted explicitly, as it is already supported , plus the filters.

Further more, some integration tests demonstrate how to filter deleted records (e.g product) from the api. While the api did not properly support it, this pr adds support to pass with_deleted flags to the query and being handled accordingly to our api support. Validators have been updated and product list end point benefit from it. Also, the list config type was already accepting such value which I have translated to the remote query config.

Also, since the previous pr was adjusting the product types, I ve adjusted them to match the expectation

@changeset-bot

changeset-bot Bot commented Jun 20, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 27b1619

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel

vercel Bot commented Jun 20, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 7:42am
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Jun 25, 2025 7:42am
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 7:42am
cloud-docs ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 7:42am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 7:42am
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 7:42am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 7:42am
resources-docs ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 7:42am
user-guide ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 7:42am

@adrien2p adrien2p changed the title fix(utils): build query withDeleted auto detection fix(utils): build query withDeleted remove auto detection Jun 20, 2025
@adrien2p

Copy link
Copy Markdown
Contributor Author

@olivermrbl would you have a minute sometime today to discuss this bad boy?

@adrien2p
adrien2p marked this pull request as ready for review June 23, 2025 08:24
@adrien2p
adrien2p requested a review from a team as a code owner June 23, 2025 08:24
@olivermrbl

Copy link
Copy Markdown
Contributor

@adrien2p, let's do it. Ping me whenever

@kodiakhq
kodiakhq Bot merged commit a833c3c into develop Jun 25, 2025
26 checks passed
@kodiakhq
kodiakhq Bot deleted the fix/with-deleted-detection branch June 25, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants