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

Wait for complete sync after adding a project #845

Open
gmaclennan opened this issue Sep 19, 2024 · 0 comments
Open

Wait for complete sync after adding a project #845

gmaclennan opened this issue Sep 19, 2024 · 0 comments

Comments

@gmaclennan
Copy link
Member

gmaclennan commented Sep 19, 2024

Description

Currently there is an edge-case code path that results in addProject resolving before all pre-sync data syncing in both directions. I don't think this codepath is being hit very frequently in actual use, because the getProjectSettings() call at the top of the function will normally return EMPTY_PROJECT_SETTINGS on this first call. The impact is not major either, because it is unlikely that data has not synced in the other direction.

The #waitForInitialSync() method is only called from addProject(), therefore the local data will be minimal: a deviceInfo record, and a coreOwnership record. It is important as part of joining a project that these records sync to other project participants, so the "correct" thing to do is wait for them to sync.

The change should be on lines https://github.com/digidem/comapeo-core/blob/main/src/mapeo-manager.js#L664-L670 to instead check the syncState['auth' | 'config'].dataToSync property.

I don't think the current code has any impact on anything, and it is unlikely to have any actual use impacts, however fixing this allows us to discount one variable when investigating bugs.

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

No branches or pull requests

1 participant