-
Notifications
You must be signed in to change notification settings - Fork 41
fix discrepancy between Android and Laptop RESOLVED_SYNC_RECORDS #126
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code seems good, let's await an android test by @SergeyZhukovsky
test/client/recordUtil.js
Outdated
|
||
t.test(`${t.name} resolves same data cross-platform on laptop and android`, (t) => { | ||
t.plan(1) | ||
const androidRecordsAndExistingObjects = require('./data/resolveAndroid').data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: I like to call test data "fixtures"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it may help to add a comment explaining how the ./data/resolveAndroid
and ./data/resolveLaptop
fixtures had been generated, such that someone could go and regenerate them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
@@ -262,6 +273,12 @@ const mergeRecords = (recordsAndObjects) => { | |||
*/ | |||
module.exports.resolveRecords = (recordsAndExistingObjects) => { | |||
let resolvedRecords = [] | |||
recordsAndExistingObjects.forEach((item) => { | |||
if (item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the item
truthiness check necessary? in mergeRecords()
we do a similar forEach()
while assuming the values of item[0] and item[1].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe not necessary at the moment but better to be safe here since resolveRecords is an exported function
browser-laptop sends 'parentFolderObjectId: []' for top-level folders whereas android sends 'parentFolderObjectId: null'. for consistency, they should just be normalized to be the same value. fix #107
It looks good. I verified it with the current pull request and laptop syncs a folder structure properly now. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
browser-laptop sends 'parentFolderObjectId: []' for top-level folders whereas
android sends 'parentFolderObjectId: null'. for consistency, they should just
be normalized to be the same value.
fix #107
TODO check if this fixes #100
test plan:
yarn dist
to build and copy the sync library over to browser-laptop. in browser-laptop, editjs/constants/appConfig
and changeisProduction
to true. then sync to "whisker..." group in browser-laptop. the hierarchy should be the same on android and laptop.