I just had an idea and wanted to check its feasibility and possible side effects before I go through the work of trying it out. Yeah, a bit of laziness I know!
Lets say we have invoice and lineitems tables. Run a query for all invoices and store the results in a temp state var. The table then gets its contents from that var instead of the query. I can programmatically add/remove items from the var and the table is filtered!
Then I can query and load all lineitems into another temp state var and wire that to a new table. This will then be programmatically filtered based on the currently selected invoice. This has the advantage of not requerying the database every single time I click a new invoice row.
Now this paradigm breaks down if there are just too many records to easily manage locally. But other than that are there any other reasons this is a bonkers idea?