AWS amplify datastore sync expression for skipping a modal from syncing

Viewed 83

I am using Amplify DataStore in my react app and I am trying to exclude these modals like ExternalTest, EmployeeTestCounter , EmployeeBarCodes, and TestConsent from syncing because I don't need them at that time:

const userSyncData = async (number) => {
    DataStore.configure({
      syncExpressions: [
        syncExpression(Test, () => {
          return test => test.phoneNumber('eq', number);
        }),
        syncExpression(ExternalTest, () => {
          return null;
        }),
        syncExpression(EmployeeTestCounter, () => {
          return null;
        }),
        syncExpression(EmployeeBarCodes, () => {
          return null;
        }),
        syncExpression(TestConsent, () => {
          return null;
        }),
      ],
    });
    await DataStore.clear();
    await DataStore.start();
  };

0 Answers
Related