Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip primary keys from the update payload #375

Closed
wants to merge 2 commits into from

Conversation

lauri865
Copy link
Contributor

Fixes #374.

Copy link

changeset-bot bot commented Feb 13, 2024

🦋 Changeset detected

Latest commit: 64ae41f

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

This PR includes changesets to release 5 packages
Name Type
@supabase-cache-helpers/postgrest-core Minor
@supabase-cache-helpers/postgrest-react-query Minor
@supabase-cache-helpers/postgrest-swr Minor
@supabase-cache-helpers/examples/react-query Patch
@supabase-cache-helpers/examples/swr 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

Copy link

vercel bot commented Feb 13, 2024

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

Name Status Preview Comments Updated (UTC)
supabase-cache-helpers ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2024 7:05pm
supabase-cache-helpers-swr-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2024 7:05pm

Copy link

vercel bot commented Feb 13, 2024

Someone is attempting to deploy a commit to a Personal Account owned by @psteinroe on Vercel.

@psteinroe first needs to authorize it.

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4ffc4c8) 97.29% compared to head (64ae41f) 91.79%.
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #375      +/-   ##
==========================================
- Coverage   97.29%   91.79%   -5.51%     
==========================================
  Files         145       48      -97     
  Lines        2111      634    -1477     
  Branches      520      138     -382     
==========================================
- Hits         2054      582    -1472     
+ Misses         57       45      -12     
- Partials        0        7       +7     
Flag Coverage Δ
postgrest-core 91.79% <ø> (-6.57%) ⬇️
postgrest-react-query 91.79% <ø> (-5.25%) ⬇️
postgrest-swr 91.79% <ø> (-1.89%) ⬇️
storage-core 91.79% <ø> (-8.21%) ⬇️
storage-react-query 91.79% <ø> (-8.21%) ⬇️
storage-swr 91.79% <ø> (-8.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@psteinroe psteinroe left a comment

Choose a reason for hiding this comment

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

lgtm

@psteinroe
Copy link
Owner

@lauri865 can you write a changes?

@lauri865
Copy link
Contributor Author

Added changest @psteinroe.

Copy link
Owner

@psteinroe psteinroe left a comment

Choose a reason for hiding this comment

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

please add a test 👍

Comment on lines +55 to +58

if (stripPrimaryKeys) {
payload[key] = undefined;
}
Copy link
Owner

Choose a reason for hiding this comment

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

should this not happen before we pass the payload to qb.update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't since we don't call the query before, and qb.update just sets a stable reference to the payload object. Thought it would keep the code simpler for future changes if we do related manipulations in one pass.

It should have tests though, I agree with that.

Copy link
Owner

Choose a reason for hiding this comment

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

I would prefer to move it up - makes it simpler to read and there is no other reason to put it down.

@psteinroe psteinroe closed this Jul 12, 2024
@elyobo
Copy link

elyobo commented Aug 27, 2024

@psteinroe this seems like a bug worth fixing, did you close it because of a lack of response from @lauri865? I might have time to continue working on this if you're still interested in a fix (I've just ran into it on my first attempt to use supabase-cache-helpers).

@psteinroe
Copy link
Owner

@elyobo yes, if you have the time I would appreciate this getting fixed very much 🙏🏼

@elyobo
Copy link

elyobo commented Aug 27, 2024

Happy to take a poke at it, but it seems like tests are failing even before running any changes; after installing with pnpm i in the current main branch I have test failures immediately. I may have missed some setup steps (I haven't worked with a turborepo repo before - some minimal getting started for contributors docs might be useful).

Edit: looking through the ci GHA workflow to figure out how to get tests working.

Edit: going through all the steps (build packages, run supabase, run tests with concurrency 1) generally works, although there are some intermittent failures. Should be enough to get things working.

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.

Primary keys not working with GENERATED ALWAYS AS IDENTITY columns
3 participants