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

fix verifyChanges causing 0: {, 1: } during insert and patch #216

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

closertotheend
Copy link
Contributor

Due to fact that most realtional dbs do not support string[] inside single column, people cast verifyChanges to text type.
When field is deserialized from db we need to parse it twice. Otherwise Object.assign({}, '{}') will yield {0:'{', 1: '}'}

Related issue:
#206

@netlify
Copy link

netlify bot commented Oct 15, 2023

Deploy Preview for feathers-a-m ready!

Name Link
🔨 Latest commit c97b82c
🔍 Latest deploy log https://app.netlify.com/sites/feathers-a-m/deploys/652d59ed26f9490008dd9f3f
😎 Deploy Preview https://deploy-preview-216--feathers-a-m.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 site configuration.

@closertotheend
Copy link
Contributor Author

Checked locally with npm link, fix seems to be working

@claustres
Copy link
Collaborator

Thanks for this as it seems to annoy many people. Not familiar enough with SQLite though to check if it's a valid workaround, but from a more general point of view I would ask if it would not be more "readable" and less risky (eg avoid any exception if user.verifyChanges is an empty string for some weird reason) with something like this (and ideally with a comment on the previous line to explain why we need it):
if (user.verifyChanges === '{}') ...

I will let run the tests anyway to ensure it works.

src/helpers/get-user-data.ts Outdated Show resolved Hide resolved
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.

None yet

3 participants