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
- fix(packages/react): infinite fetch via stale proxy #1588 — committed to gqty-dev/gqty by vicary a year ago
 - fix(packages/react): infinite fetch via stale proxy #1588 — committed to gqty-dev/gqty by vicary a year ago
 - fix(packages/react): infinite fetch via stale proxy #1588 — committed to gqty-dev/gqty by vicary a year ago
 - feat: Scoped Queries (#1544) * feat(package/core): scoped query * feat(package/subscriptions): drop the package for graphql-ws * feat(packages/utils): drop unused package * fix(packages/logger): s... — committed to gqty-dev/gqty by vicary 2 months ago
 
i can confirm, no more loops! 🚀
With
alpha-085ddbf4.0your 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:
query.cars, andquery.passengersWhen 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’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!