MCPcopy Create free account
hub / github.com/error311/FileRise / _fetchJSONWithTimeout

Function _fetchJSONWithTimeout

public/js/fileListView.js:4240–4247  ·  view source on GitHub ↗
(url, ms = 2500)

Source from the content-addressed store, hash-verified

4238
4239// tiny fetch helper with timeout for folder counts
4240function _fetchJSONWithTimeout(url, ms = 2500) {
4241 const ctrl = new AbortController();
4242 const tid = setTimeout(() => ctrl.abort(), ms);
4243 return fetch(url, { credentials: 'include', signal: ctrl.signal })
4244 .then(r => r.ok ? r.json() : { folders: 0, files: 0, __fr_err: 1 })
4245 .catch(() => ({ folders: 0, files: 0, __fr_err: 1 }))
4246 .finally(() => clearTimeout(tid));
4247}
4248
4249// Defensive: some browsers occasionally blank out inline SVGs elsewhere when a context menu opens.
4250// This only repaints *blank* strip/inline-folder icons (no re-render churn when nothing is wrong).

Callers 2

startFunction · 0.85
fetchFolderSummaryStatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected