Awesome Reviewers

When dealing with possibly missing or nullable values (especially globals and config), make null/undefined handling explicit and never call a value unless you’ve verified its type.

Apply this standard:

Example:

function isDocumentVisible(document) {
  return (
    document.visibilityState === undefined ||
    document.visibilityState === 'visible' ||
    document.visibilityState === 'prerender'
  );
}

function shouldRetry(query, error) {
  const retry = query.config.retry;

  if (retry === true) return true;
  if (typeof retry === 'number') return query.state.failureCount <= retry;
  if (typeof retry === 'function') {
    return retry(query.state.failureCount, error);
  }
  return false;
}