mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
feat: implement map and find optimization
This commit is contained in:
parent
b1631cd6f1
commit
03a24686fe
3 changed files with 11 additions and 6 deletions
|
|
@ -246,9 +246,11 @@ export function useDocuments(
|
|||
status: (doc.status as unknown as DocumentStatusType) ?? { state: "ready" },
|
||||
}));
|
||||
|
||||
const liveById = new Map(validItems.map((v) => [v.id, v]));
|
||||
|
||||
let updated = prev.map((existing) => {
|
||||
if (liveIds.has(existing.id)) {
|
||||
const liveItem = validItems.find((v) => v.id === existing.id);
|
||||
const liveItem = liveById.get(existing.id);
|
||||
if (liveItem) {
|
||||
return {
|
||||
...existing,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue