Objects Meeting Sync Rule Criteria

We have a “Survey” object which has sync rules configured such that a user will have all Surveys (and its related objects) they created and any Surveys that another user has shared with them via a join table. Most users will work out of their My Surveys view which uses the standard DB to show these synced Surveys.

However in some cases, a user with the appropriate permissions may need to access another user’s Survey via an online-only view. They can then open the survey and look through it and its related objects. The problem is that we want to reuse the rest of our app for this process which is built on the standard DB and we would prefer not to have to refactor every view to work correctly with querying objects from OnlineDB when needed. The natural solution we came up with is to “force share” the survey with the user (i.e. automatically create the join table entry) which should trigger the sync rule and make the survey available via the standard DB rather than just OnlineDB.

However this brings up a new issue. How long does the user have to wait for the sync rule to kick in after the join table object is created? And how do we handle their app experience in the meantime? Should the Online Surveys view only allow sharing with yourself and then you have to go back to the “My Surveys” view and refresh until you get this survey? Is there a better way?

Any insight is appreciated.

Thanks,
Fletcher

My suggestion would be to use the journey.syncrhonize function to force the app to synchronize data with the backend directly after you create the new join table option (see docs).

Since they are already online, you can likely expect the only data that needs to be synced would be the new join table object that was created so the process will be quick depending on how much data is synced via the survey. There may not need to be anything you need to do for user experience depending on how quickly the data syncs. If it does require some user experience updates, you could apply a timeout before entering the survey, notify the user to wait until their sync indicator gives them the green check before continuing, or as you mentioned, you could have them return to their “My Surveys” view and refresh until it’s present. (Please see our docs on data syncrhonization logic to understand what might make that sync time increase.)