Skip to content

Commit d487254

Browse files
committed
refactor: tidy use of Set for store subscribers
There's no need to check that a Set has an element before trying to remove it.
1 parent b2260bc commit d487254

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/runtime/store/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ export function writable<T>(value?: T, start: StartStopNotifier<T> = noop): Writ
9797
run(value);
9898

9999
return () => {
100-
if (subscribers.has(subscriber)) {
101-
subscribers.delete(subscriber);
102-
}
100+
subscribers.delete(subscriber);
103101
if (subscribers.size === 0) {
104102
stop();
105103
stop = null;

0 commit comments

Comments
 (0)