Skip to content

Details of useParseQuery's isLive and isSyncing #47

Closed
@rshov

Description

@rshov

Hi, thank you for this library. I know it is still in alpha and you're looking for feedback - I think the direction of this is right on track.

I'm starting a project with Next.js and Parse. The useParseQuery hook works much like react-query, which is exactly what I'm looking for. But I'd like some more information on isLive and isSyncing.

This is what I started with, which I expected would work:

  const {
    isLoading,
    results,
    error
  } = useParseQuery(parseQuery)

  if (isLoading) return <Spinner />
  if (error) return <ErrorMessage error={error} />
  if (!results || !results.length) return <ErrorMessage error='Project not found' />

  // Otherwise display the project info...
  return (
    // Project info
  )

The above resulted in a error message flashing for a second "Project not found" until the project object was loaded (this is just after creating a new project object in the parse db).

If I add checks for isLive and isSyncing, then the error message does not show.

  if (!isLive || isLoading || isSyncing) return <Spinner />

I would expect that checking isLoading would be enough. Do I need to also check isLive and isSyncing?

Thank you!
Raymond

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions