msupply-foundation / openmsupply-client

Someone should really write a description for this repo.
2 stars 0 forks source link

Refactor userQueryParams for Outbounds #1218

Closed mark-prins closed 2 years ago

mark-prins commented 2 years ago

Fixes #1204

Am creating the PR at this stage.. there is more refactoring to do, but I want to reduce the number of files in the PR 😉 This one is the essence of the change - the next steps are:

The core of the problem is that the current hooks aren't sharing state.. so a list of items is retrieved by two separate calls, and each has different query params, though the code is expecting to see the same list of results.

I've lifted the queryParams state out, so it is created in the page context. Almost always, this is within the table context, so have created a query params context which is instantiated by the table context. For the cases where the queryParams are used outside of the table context (Name search is one) then the query params context can be instantiated separately.

Will also replace the useSharedSort implementation required by this PR: https://github.com/openmsupply/openmsupply-client/pull/1017 as I expect that won't be needed now.

github-actions[bot] commented 2 years ago

Bundle size difference

Comparing this PR to main

Old size New size Diff
3.79 MB 3.8 MB 3.03 KB (0.08%)