Skip to content

Commit 263af0d

Browse files
authored
fix: remove invalid WeakSet.clear() call from resetRegistration() (#530)
WeakSet does not have a .clear() method in JavaScript. The previous call would throw a TypeError at runtime. This is intentional because: 1. WeakSet entries are garbage-collected automatically when the referenced object is no longer reachable. 2. Module hot-reload triggers a fresh module state, creating a new _registeredApis WeakSet automatically. 3. The existing comment already documented the design intent.
1 parent adb621e commit 263af0d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4139,7 +4139,7 @@ export function resetRegistration() {
41394139
// Note: WeakSets cannot be cleared by design. In test scenarios where the
41404140
// same process reloads the module, a fresh module state means a new WeakSet.
41414141
// For hot-reload scenarios, the module is re-imported fresh.
4142-
_registeredApis.clear();
4142+
// (WeakSet.clear() does not exist, so we do nothing here.)
41434143
}
41444144

41454145
export default memoryLanceDBProPlugin;

0 commit comments

Comments
 (0)