How to use the react-orbitjs.useCache function in react-orbitjs

To help you get started, we’ve selected a few react-orbitjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / data / containers / resources / user-task / list.tsx View on Github external
export function useUserTasksForCurrentUser(
  include?: string[]
): {
  error: Error;
  isLoading: boolean;
  userTasks: UserTaskResource[];
} {
  useLiveData('user-tasks');

  const { error, isLoading } = useUserTasksList(include);
  const { currentUser } = useCurrentUser();

  const {
    subscriptions: { userTasks },
  } = useCache({
    userTasks: (q) => q.findRecords('userTask').filter({ relation: 'user', record: currentUser }),
  });

  return { error, isLoading, userTasks: userTasks || [] };
}