Garbage collection when scope values are Symbols #38
-
Hi! I was an example of using scopes for Forms, and the Vue example was providing a symbol as the value of a scope. <script setup>
import { provideScope } from 'bunshi/vue';
import { formIdScope } from '../scopes'
const formId = Symbol();
provideScope([formIdScope,formId])
</script>
<template>
<form>
Form id: {{formId}}
<slot></slot>
<form>
</template> I was wondering if the molecule instance garbage collection is handled by Bunshi in this case, given that the symbol for example is not used by anything else anymore? (the component that provided the scope was unmounted). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I personally use React, but I guess this functionality should be framework agnostic, if implemented. |
Beta Was this translation helpful? Give feedback.
-
Yes, the browser's JavaScript engine should garbage collect the symbols, and the related bunshi molecules, when there are no more references to them. |
Beta Was this translation helpful? Give feedback.
Yes, the browser's JavaScript engine should garbage collect the symbols, and the related bunshi molecules, when there are no more references to them.