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:

@Ldoppea Ldoppea force-pushed the fix/offline_reviews_feedbacks branch from 813017e to ded3440 Compare September 4, 2024 16:11
@Ldoppea Ldoppea force-pushed the fix/offline_attributes branch from 8708811 to 21eaf5f Compare September 4, 2024 16:13
@Ldoppea Ldoppea force-pushed the fix/offline_reviews_feedbacks branch from ded3440 to 67db2ab Compare September 5, 2024 07:46
@Ldoppea Ldoppea force-pushed the fix/offline_attributes branch from 21eaf5f to 04ad0eb Compare September 5, 2024 07:46
@Ldoppea Ldoppea force-pushed the fix/offline_reviews_feedbacks branch from 67db2ab to ce86492 Compare September 9, 2024 13:52
Base automatically changed from fix/offline_reviews_feedbacks to feat/meta_offline September 9, 2024 14:08
@Ldoppea Ldoppea force-pushed the fix/offline_attributes branch from 04ad0eb to 54669fd Compare September 9, 2024 14:09
@Ldoppea Ldoppea requested a review from cballevre as a code owner September 9, 2024 14:25
@Ldoppea Ldoppea force-pushed the fix/offline_attributes branch 3 times, most recently from 6c25810 to 6c09399 Compare September 11, 2024 15:04
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 force-pushed the fix/offline_attributes branch from 6c09399 to 75bd960 Compare September 12, 2024 15:17
@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