fix(disposable/deduped): call dispose with disposable context

This commit is contained in:
Julien Fontanet 2021-03-24 00:27:25 +01:00
parent b243ff94e9
commit 8921d78610
2 changed files with 4 additions and 3 deletions

View File

@ -17,15 +17,15 @@ exports.deduped = (factory, keyFn = (...args) => args) =>
if (state === undefined) { if (state === undefined) {
const result = factory.apply(this, arguments) const result = factory.apply(this, arguments)
const createFactory = ({ value, dispose }) => { const createFactory = disposable => {
const wrapper = { const wrapper = {
dispose() { dispose() {
if (--state.users === 0) { if (--state.users === 0) {
states.delete(keys) states.delete(keys)
return dispose() return disposable.dispose()
} }
}, },
value, value: disposable.value,
} }
return () => { return () => {

View File

@ -32,6 +32,7 @@
> >
> In case of conflict, the highest (lowest in previous list) `$version` wins. > In case of conflict, the highest (lowest in previous list) `$version` wins.
- @xen-orchestra/disposable patch
- xo-server-transport-email minor - xo-server-transport-email minor
- @xen-orchestra/fs minor - @xen-orchestra/fs minor
- @xen-orchestra/xapi minor - @xen-orchestra/xapi minor