fix(review): show complete counts and load large diffs progressively (#10822)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
32e8b25845
commit
aae361c4ef
22 files changed
+1484
-390
No files matched your search
@@ -8,7 +8,11 @@ interface FileRevealHandle {
|
||||
|
||||
// Wait for a mounted viewer and expanded rows, then apply each tree click once.
|
||||
// Keep scope stable until the diff or external file selection changes.
|
||||
export function useCodeViewFileReveal<TScope>(viewer: FileRevealHandle | null, scope: TScope) {
|
||||
export function useCodeViewFileReveal<TScope>(
|
||||
viewer: FileRevealHandle | null,
|
||||
scope: TScope,
|
||||
readyFileKeys?: ReadonlyArray<string>,
|
||||
) {
|
||||
const [request, setRequest] = useState<{ fileKey: string; scope: TScope } | null>(null);
|
||||
const handledRequest = useRef<typeof request>(null);
|
||||
|
||||
@@ -18,11 +22,12 @@ export function useCodeViewFileReveal<TScope>(viewer: FileRevealHandle | null, s
|
||||
handledRequest.current = request;
|
||||
return;
|
||||
}
|
||||
if (!viewer?.getInstance()) return;
|
||||
if (!viewer?.getInstance() || (readyFileKeys && !readyFileKeys.includes(request.fileKey)))
|
||||
return;
|
||||
|
||||
viewer.scrollTo({ type: "item", id: request.fileKey, align: "start" });
|
||||
handledRequest.current = request;
|
||||
}, [request, scope, viewer]);
|
||||
}, [request, scope, viewer, readyFileKeys]);
|
||||
|
||||
return useCallback((fileKey: string) => setRequest({ fileKey, scope }), [scope]);
|
||||
}
|
||||
Reference in new issue
Block a user