Skip to content

Commit 234f1b6

Browse files
committed
revert push logic and refactor remove logic
1 parent 9245b43 commit 234f1b6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/client/lib/client/linked-list.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class DoublyLinkedList<T> {
3030

3131
if (this.#tail === undefined) {
3232
return this.#head = this.#tail = {
33-
previous: undefined,
33+
previous: this.#head,
3434
next: undefined,
3535
value
3636
};
@@ -73,7 +73,7 @@ export class DoublyLinkedList<T> {
7373
--this.#length;
7474
const node = this.#head;
7575
if (node.next) {
76-
node.next.previous = node.previous;
76+
node.next.previous = undefined;
7777
this.#head = node.next;
7878
node.next = undefined;
7979
} else {
@@ -92,11 +92,11 @@ export class DoublyLinkedList<T> {
9292
this.#head = node.next;
9393
} else {
9494
if (node.previous) {
95-
node.previous.next = node.next;
95+
node.previous.next = node.next;
96+
}
97+
if (node.next) {
98+
node.next.previous = node.previous;
9699
}
97-
}
98-
if (node.next) {
99-
node.next.previous = node.previous;
100100
}
101101
node.previous = undefined;
102102
node.next = undefined;

0 commit comments

Comments
 (0)