You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #467. useModels sends refresh=true unconditionally on every mount (loaders.js:14), which forces the backend to do a full filesystem scan + Hub metadata fetch on every tab open, focus event, and remount across three call sites (ModelsContainer, ServiceModal, NewJobModal). This was the fuel for the duplicate-row race fixed in #467, and it's independently wasteful backend work.
Why the default can safely change
The backend inserts into the model table on download success (asgi.py:2626-2700). Models downloaded through the app appear in the DB immediately — no scan required.
Without refresh=true, the endpoint returns DB contents. That's the correct source of truth for the common case.
The models page already has a refresh button — the one legitimate "force a scan" trigger already exists in the UI.
The only case the DB-only read misses is out-of-band additions (someone runs hf download directly on the cluster). Users who hit that case can press the refresh button on the models page.
Context
Follow-up to #467.
useModelssendsrefresh=trueunconditionally on every mount (loaders.js:14), which forces the backend to do a full filesystem scan + Hub metadata fetch on every tab open, focus event, and remount across three call sites (ModelsContainer, ServiceModal, NewJobModal). This was the fuel for the duplicate-row race fixed in #467, and it's independently wasteful backend work.Why the default can safely change
modeltable on download success (asgi.py:2626-2700). Models downloaded through the app appear in the DB immediately — no scan required.refresh=true, the endpoint returns DB contents. That's the correct source of truth for the common case.The only case the DB-only read misses is out-of-band additions (someone runs
hf downloaddirectly on the cluster). Users who hit that case can press the refresh button on the models page.Proposed change
In
useModels(loaders.js:8-40):refresh=truefrom the default SWR key and fetcher URLs.revalidateOnFocus: falseand a modestdedupingInterval(e.g. 60s) to the SWR config.refresh()action that calls therefresh=trueURL once and writes the result into the cache viamutate(fresh, { revalidate: false }).refresh()instead of plainmutate().No changes needed to
ServiceModalorNewJobModal— they get the DB-cached list, which is fast and correct.Expected impact
Verification