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: Remove attributes and meta attributes before persisting docs #1525

Merged
merged 8 commits into from
Sep 12, 2024

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Sep 4, 2024

Those doc's attributes are specific to the JSON API and should not be inserted into the Pouch database

This implies that we will have a difference on documents regarding if they are served through the cozy-stack or through a local PouchDB, the first one may include those fields in their result, but not the second one

So from now we should avoid, as much as possible, to relies on the attributes member to prevent bugs on Offline mode. Multiple commits to fix usages of attributes in cozy-client will be done after this one

Usage of attributes and meta members on cozy-app will also have to be fixed. This will be a requirement to implement Offline mode on cozy-apps


Related PRs:

Copy link
Contributor

@paultranvan paultranvan left a comment

Choose a reason for hiding this comment

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

Thanks!

packages/cozy-pouch-link/src/CozyPouchLink.js Outdated Show resolved Hide resolved
Those doc's attributes are specific to the JSON API and should not be
inserted into the Pouch database

This implies that we will have a difference on documents regarding if
they are served through the cozy-stack or through a local PouchDB, the
first one may include those fields in their result, but not the second
one

So from now we should avoid, as much as possible, to relies on the
`attributes` member to prevent bugs on Offline mode. Multiple commits to
fix usages of `attributes` in cozy-client will be done after this one

Usage of `attributes` and `meta` members on cozy-app will also have to
be fixed. This will be a requirement to implement Offline mode on
cozy-apps

This replies to #1486 (comment)
By doing so we add unnecessary values to the capabilities object that
will now contain more data than just `.attributes`

As those are supernumerary values we consider that this is not
problematic, but we may want to find a cleaner solution in the future
Calls of `isInstalled` and all related methods have been checked and
`apps` parameter is always a result of `client.query()` so we know that
`.slug` can be used in replacement of `.attributes.slug`
Calls of those methods have been checked and `instanceInfo` parameter
is always a result of `useInstanceInfo` so we know that `.attributes`
can be omited
@Ldoppea Ldoppea merged commit 9323924 into feat/meta_offline Sep 12, 2024
2 checks passed
@Ldoppea Ldoppea deleted the fix/offline_attributes branch September 12, 2024 15:50
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.

2 participants