Skip to content
This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

fix discrepancy between Android and Laptop RESOLVED_SYNC_RECORDS #126

Merged
merged 1 commit into from
Jul 6, 2017

Conversation

diracdeltas
Copy link
Member

@diracdeltas diracdeltas commented Jul 6, 2017

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:

  1. tests should pass
  2. for serg: check out this pull request, then run yarn dist to build and copy the sync library over to browser-laptop. in browser-laptop, edit js/constants/appConfig and change isProduction to true. then sync to "whisker..." group in browser-laptop. the hierarchy should be the same on android and laptop.

@diracdeltas diracdeltas self-assigned this Jul 6, 2017
Copy link
Contributor

@ayumi ayumi left a 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


t.test(`${t.name} resolves same data cross-platform on laptop and android`, (t) => {
t.plan(1)
const androidRecordsAndExistingObjects = require('./data/resolveAndroid').data
Copy link
Contributor

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"

Copy link
Contributor

@ayumi ayumi Jul 6, 2017

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.

Copy link
Member Author

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) {
Copy link
Contributor

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].

Copy link
Member Author

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
@SergeyZhukovsky
Copy link
Member

It looks good. I verified it with the current pull request and laptop syncs a folder structure properly now. Thanks!

Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

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

++

@ayumi ayumi merged commit efa2bec into staging Jul 6, 2017
@ayumi ayumi deleted the fix/107 branch July 6, 2017 16:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change to Parent bookmark folder on Android is not sycned to laptop or iOS device Wrong folders structure
3 participants