@servicetitan/ko-bridge
Advanced tools
Comparing version 19.2.0 to 19.3.0
@@ -13,5 +13,7 @@ "use strict"; | ||
let value; | ||
let lastKoObservable; | ||
function firstAccessInit() { | ||
if (!value) { | ||
if (lastKoObservable !== lazyKoObservable()) { | ||
value = convertKoObservableToMobx(lazyKoObservable()); | ||
lastKoObservable = lazyKoObservable(); | ||
} | ||
@@ -18,0 +20,0 @@ } |
{ | ||
"name": "@servicetitan/ko-bridge", | ||
"version": "19.2.0", | ||
"version": "19.3.0", | ||
"description": "", | ||
@@ -38,3 +38,3 @@ "homepage": "https://docs.st.dev/docs/frontend/ko-bridge", | ||
}, | ||
"gitHead": "62c48deffc4ed9aba58325fbad1b256ecbfae553" | ||
"gitHead": "c2541cf4d4dc01064f7d327370a90f7b4d107a0e" | ||
} |
@@ -155,1 +155,20 @@ import { autorun } from 'mobx'; | ||
}); | ||
test('Reassign ko.observable after `value` is read', () => { | ||
let koObservable = ko.observable(true); | ||
class Store { | ||
@koObservableToMobx(() => koObservable) | ||
declare value: string; | ||
} | ||
const instance = new Store(); | ||
expect(instance.value).toBe(true); | ||
koObservable = ko.observable(true); | ||
koObservable(false); | ||
expect(instance.value).toBe(false); | ||
}); |
@@ -11,6 +11,8 @@ import { computed, createAtom, IComputedValue } from 'mobx'; | ||
let value: IComputedValue<T>; | ||
let lastKoObservable: KnockoutObservable<T> | undefined; | ||
function firstAccessInit() { | ||
if (!value) { | ||
if (lastKoObservable !== lazyKoObservable()) { | ||
value = convertKoObservableToMobx(lazyKoObservable()); | ||
lastKoObservable = lazyKoObservable(); | ||
} | ||
@@ -17,0 +19,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
36398
733