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

Function resolveServerPagingCursorForLoad

public/js/fileListView.js:2023–2047  ·  view source on GitHub ↗
({ pane, folder, sourceId, requestedCursor })

Source from the content-addressed store, hash-verified

2021}
2022
2023function resolveServerPagingCursorForLoad({ pane, folder, sourceId, requestedCursor }) {
2024 if (requestedCursor != null) {
2025 return String(requestedCursor);
2026 }
2027 if (window.viewMode !== 'table' || window.showInlineFolders === false) {
2028 return '';
2029 }
2030
2031 const paneKey = normalizePaneKey(pane);
2032 const state = getPaneState(paneKey);
2033 const pageRaw = Number(state?.currentPage || window.currentPage || 1);
2034 const targetPage = Number.isFinite(pageRaw) ? Math.max(1, Math.floor(pageRaw)) : 1;
2035 if (targetPage <= 1) {
2036 return '';
2037 }
2038
2039 const subfolders = getSubfoldersForPagingContext(paneKey, folder, sourceId);
2040 const totalFolders = Array.isArray(subfolders) ? subfolders.length : 0;
2041 if (totalFolders <= 0) {
2042 return '';
2043 }
2044 const pageSize = getFileListCursorPageSize();
2045 const fileOffset = Math.max(0, ((targetPage - 1) * pageSize) - totalFolders);
2046 return String(fileOffset);
2047}
2048
2049let __frTreeSourceId = null;
2050

Callers 1

loadFileListFunction · 0.85

Calls 4

normalizePaneKeyFunction · 0.85
getPaneStateFunction · 0.85

Tested by

no test coverage detected