How to use the scheduler.unstable_NormalPriority function in scheduler

To help you get started, weโ€™ve selected a few scheduler 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 facebook / relay / packages / relay-experimental / useBlockingPaginationFragment.js View on Github external
(...callArgs) => {
      if (
        Scheduler.unstable_getCurrentPriorityLevel() <
        Scheduler.unstable_NormalPriority
      ) {
        warning(
          false,
          'Relay: Unexpected call to `%s` at a priority higher than ' +
            'expected on fragment `%s` in `%s`. It looks like you tried to ' +
            'call `refetch` under a high priority update, but updates that ' +
            'can cause the component to suspend should be scheduled at ' +
            'normal priority. Make sure you are calling `refetch` inside ' +
            '`startTransition()` from the `useSuspenseTransition()` hook.',
          args.direction === 'forward' ? 'loadNext' : 'loadPrevious',
          args.fragmentNode.name,
          args.componentDisplayName,
        );
      }

      return _loadMore(...callArgs);
github facebook / relay / packages / relay-experimental / useRefetchableFragmentNode.js View on Github external
if (isMountedRef.current !== true) {
        warning(
          false,
          'Relay: Unexpected call to `refetch` on unmounted component for fragment ' +
            '`%s` in `%s`. It looks like some instances of your component are ' +
            'still trying to fetch data but they already unmounted. ' +
            'Please make sure you clear all timers, intervals, ' +
            'async calls, etc that may trigger a fetch.',
          fragmentNode.name,
          componentDisplayName,
        );
        return {dispose: () => {}};
      }
      if (
        Scheduler.unstable_getCurrentPriorityLevel() <
        Scheduler.unstable_NormalPriority
      ) {
        warning(
          false,
          'Relay: Unexpected call to `refetch` at a priority higher than ' +
            'expected on fragment `%s` in `%s`. It looks like you tried to ' +
            'call `refetch` under a high priority update, but updates that ' +
            'can cause the component to suspend should be scheduled at ' +
            'normal priority. Make sure you are calling `refetch` inside ' +
            '`startTransition()` from the `useSuspenseTransition()` hook.',
          fragmentNode.name,
          componentDisplayName,
        );
      }
      if (parentFragmentRef == null) {
        warning(
          false,