SeedCompany / cord-field

CORD UI
MIT License
7 stars 3 forks source link

Extract data handing for tables to a generic hook #1531

Closed CarsonF closed 3 months ago

CarsonF commented 3 months ago

https://seed-company-squad.monday.com/boards/5989610236/pulses/6654772311

Extracting this logic to be generic & type safe is harder, but then result is

const [props] = useTable({
  query: PartnerProjectsDocument,
  variables: { id: partnerId },
  listAt: 'partner.projects',
  initialInput: {
    sort: 'name',
    count: 20,
  },
});

which is really nice IMO.

I also fixed the bug where parsed temporal objects would be written back to cache and then double transformed. Both by avoiding writing them & by checking to not double transform (with a dev warning).

CarsonF commented 3 months ago

There will be breaking changes from v7 which will cause some types issues and props, but should be easy to fix.

One spot now instead of N 😉