Skip to content

Commit aea4d65

Browse files
committed
added comments describing why we use get_registered_params before notifying read methods
1 parent f1285d3 commit aea4d65

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/svelte/src/reactivity/map.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ export const ReactiveMap = make_reactive(Map, {
2020
}
2121

2222
options.get_registered_params('has')?.forEach((value, param) => {
23+
// because we don't want to notify `has` for items that are currently not in the map
2324
if (!options.value.has(param)) {
2425
return;
2526
}
2627
options.notify_read_properties(['has'], param);
2728
});
2829

2930
options.get_registered_params('get')?.forEach((value, param) => {
31+
// because we don't want to notify `get` for items that are currently not in the map
3032
if (!options.value.has(param)) {
3133
return;
3234
}

packages/svelte/src/reactivity/set.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const ReactiveSet = make_reactive(Set, {
1616
return false;
1717
}
1818
options.get_registered_params('has')?.forEach((value, param) => {
19+
// because we don't want to notify `has` for items that are currently not in the set
1920
if (!options.value.has(param)) {
2021
return;
2122
}

0 commit comments

Comments
 (0)