Skip to content

Commit fc5d4ce

Browse files
committed
refactor: simplify releaseLink function by removing redundant checks
1 parent e682f78 commit fc5d4ce

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/system.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,19 @@ export function getLink(dep: Dependency, sub: Subscriber, nextDep: Link | undefi
9393
}
9494

9595
export function releaseLink(link: Link): void {
96-
const dep = link.dep;
9796
const nextSub = link.nextSub;
9897
const prevSub = link.prevSub;
9998

10099
if (nextSub !== undefined) {
101100
nextSub.prevSub = prevSub;
101+
} else {
102+
link.dep.subsTail = prevSub;
102103
}
104+
103105
if (prevSub !== undefined) {
104106
prevSub.nextSub = nextSub;
105-
}
106-
107-
if (nextSub === undefined) {
108-
dep.subsTail = prevSub;
109-
}
110-
if (prevSub === undefined) {
111-
dep.subs = nextSub;
107+
} else {
108+
link.dep.subs = nextSub;
112109
}
113110

114111
// @ts-expect-error

0 commit comments

Comments
 (0)