specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
61 stars 36 forks source link

Disabled relationship fields slowly appear #3001

Open grantfitzsimmons opened 1 year ago

grantfitzsimmons commented 1 year ago

https://user-images.githubusercontent.com/37256050/219246575-e8268ae6-e616-4164-82a8-8b5ed8b97f23.mov

https://coldfish-edge.test.specifysystems.org/specify/view/loan/330/

You can see that when I expand or collapse an item in the grid, you can see the relationship fields are slow to load and disappear and reappear

maxpatiiuk commented 1 year ago

are slow to load

They have to fetch data from a separate table (Taxon). In the current system, they have to make a network request each time you expand/collapse

This will be fixed with the ORM rewrite as I was going to add a weak form of caching just for use cases like this

grantfitzsimmons commented 1 year ago

@maxpatiiuk Has anything changed since this issue was created?

melton-jason commented 1 year ago

I'll let @maxpatiiuk correct me, but I don't think there have been any changes related to this.

This is one of the main motivators to rewriting the ORM: have a temporary cache of resources on the client side (web-browser) so it does not have to make so many network requests.

maxpatiiuk commented 1 year ago

Jason is perfectly correct.

Of course, once you introduce any sort of cache, you also introduce an issue of cache invalidation - but even that could be largely mitigated

i.e, cache at most for x seconds (i.e 10 seconds) - low enough to avoid issues with fetching stale resource, high enough to avoid many duplicated fetching issues (i.e, when same resource is fetched multiple times by format() - when formatting resource)

or do something fancier and only cache while resource is being used by any react component (i.e if any useResource(tableName, id) hook is present)

emenslin commented 1 month ago

Can recreate in edge (7.9.6)