gqty: infinite render loop with data table components

Hi,

in version 3.0.0-alpha-1b4ddaba.0 i am running in infinite render loops when using https://v2.grommet.io/datatable or https://react-data-table-component.netlify.app/?path=/story/getting-started-intro--page

the component renders over and over - when downgrading to 2.3.0 everything is working fine

import { DataTable, Text } from "grommet"
import { useQuery } from "../gqty"


const Start = () => {

  console.log("render loooop!")
  const q = useQuery()

  return (
    <div>
      <DataTable
        data={q.students()}
        columns={[
          {
            property: 'lastname',
            header: <Text>Name</Text>,
          },
        ]} />
    </div>
  )
}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

i can confirm, no more loops! 🚀

With alpha-085ddbf4.0 your repo is no longer looping, moving on to mutations.

So when you’re querying two lists, refetching is the only way.

There are two top-level cache key at play:

  1. query.cars, and
  2. query.passengers

When you update the car of a passenger, you can only query the new car, thus update its population, leaving the population of the old car dangling/stale.

With the mutation response alone, we have no way to directly update the top level cache key query.cars, post-mutation refetching is required in this scenario.

i am a bit short in time

I’ll leave this open until Friday, but you may leave a comment here if you’re still hitting anything.

I’m closing this for now, feel free to reopen if it happens again!

Hi @vicary - just tested the new release in my project and it is working pretty well now 😃

thanks a lot!