Skip to content

Commit

Permalink
perf(json-crdt): ⚡️ improve first chunk finding implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Apr 30, 2024
1 parent 94ac96b commit 5e7e661
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/json-crdt/nodes/rga/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import type {AbstractRga, Chunk} from "./AbstractRga";
/** Find the first visible chunk, if any. */
export const firstVis = <T>(rga: AbstractRga<T>): Chunk<T> | undefined => {
let curr = rga.first();
if (!curr) return;
while (curr.del) {
curr = rga.next(curr);
if (!curr) return;
}
while (curr && curr.del) curr = rga.next(curr);
return curr;
};

0 comments on commit 5e7e661

Please sign in to comment.