Skip to content

Conversation

zatteo
Copy link
Member

@zatteo zatteo commented Apr 16, 2025

No description provided.

@Ldoppea Ldoppea force-pushed the fix/package-misaligned branch 2 times, most recently from 4796979 to 794744a Compare April 17, 2025 15:50
@zatteo
Copy link
Member Author

zatteo commented Apr 17, 2025

There is test: Correctly set dir_id for selectors tests at end of commit message

@Ldoppea Ldoppea force-pushed the fix/package-misaligned branch from 794744a to b098b7e Compare April 17, 2025 15:53
Since cozy/cozy-client#1594 the `selectors.spec.js` test where failing

This was due to incorrect mock for `client.requestQuery` that would
return incorrect values with mixed folders and files where
queryDefinition did request for only one type

With previous cozy-client implementation, the `extractAndMergeDocument`
would always return a new reference for the documents list. Then on the
store's Reducer, the `haveDocumentsChanged` variable would always be
`true`, so the queries helpers would try to auto update the queries and
so would replay them with Sift

The combination of incorrect mock + incorrect `dir_id` fields would
result to Sift not being able to retrieve existing files and so it
would chose to empty the entire `data` field from the `file` query in
the redux store

Also the `directory` query would contains both files and folders, so
the test did see 13 items in queries, but for the wrong reason:
- Instead of having: `files query=> 10 files` and `directories query => 3 folders`
- We had: `files query=> 0 files` and `directories query => 3 folders and 10 files`

With the new cozy-client implementation, the `extractAndMergeDocument`
would return the reference for the documents list as both `file` and
`directory` queries where mocked to receive the exact same content, so
the documents list was identical. Then the on the store's Reducer, the
`haveDocumentsChanged` variable would be `false`, and so the queries
helpers would not replay queries with Sift

So we obtained the following result:
`files query=> 3 folders and 10 files` and
`directories query => 3 folders and 10 files`, resulting to 26 items

This shows that with the new implementation, cozy-client is more
sensitive to impossible tests configurations

By fixing the mock, we now correctly have: `files query=> 10 files` and
`directories query => 3 folders`

The fix on the `dir_id` is not mandatory here, because there are no
intersection between both queries results, but we chose to still add it
in order to have a clean test setup
@Ldoppea Ldoppea force-pushed the fix/package-misaligned branch from b098b7e to 1e8b622 Compare April 17, 2025 15:54
Copy link

bundlemon bot commented Apr 17, 2025

BundleMon

Files updated (6)
Status Path Size Limits
services/qualificationMigration.js
273.84KB (+2.24KB +0.82%) -
services/dacc.js
256.78KB (+2.23KB +0.88%) -
static/js/(chunkId).(hash).js
1.06MB (-3.09KB -0.28%) -
public/static/js/(chunkId).(hash).js
859.38KB (-3.8KB -0.44%) -
static/js/cozy.(hash).js
813.42KB (-75.12KB -8.45%) -
public/static/js/cozy.(hash).js
676.58KB (-75.41KB -10.03%) -
Unchanged files (15)
Status Path Size Limits
(hash).js
337.62KB -
public/(hash).js
337.62KB -
static/js/main.(hash).js
128.01KB -
public/static/js/public.(hash).js
99.1KB -
public/static/js/lib-react.(hash).js
39.37KB -
static/js/lib-react.(hash).js
39.37KB -
public/static/css/cozy.(hash).css
34.74KB -
static/css/cozy.(hash).css
34.74KB -
public/static/js/lib-router.(hash).js
22.05KB -
static/js/lib-router.(hash).js
22.05KB -
static/css/main.(hash).css
16.24KB -
public/static/css/public.(hash).css
5.59KB -
manifest.webapp
1.91KB -
index.html
686B -
assets/manifest.json
185B -

Total files change -152.96KB -2.92%

Groups updated (1)
Status Path Size Limits
**/*.js
6.56MB (-123.53KB -1.81%) -
Unchanged groups (2)
Status Path Size Limits
**/*.{png,svg,ico}
2.44MB -
**/*.css
131.37KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@zatteo
Copy link
Member Author

zatteo commented Apr 17, 2025

Thank you a lot for this fix! And as always, awesome commit explanation!

@zatteo zatteo merged commit 90075f7 into master Apr 17, 2025
4 checks passed
@zatteo zatteo deleted the fix/package-misaligned branch April 17, 2025 16:02
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