Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit fefe5b8

Browse files
committed
Allows updating more resources automagically
1 parent d1b12ca commit fefe5b8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"version": "0.35.1",
1010
"type": "module",
11+
"license": "MIT",
1112
"exports": {
1213
".": {
1314
"import": "./dist/index.js",

src/stores/getValue.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export const getValue = <T extends JSONValue = JSONValue>(
1818
const adStore = get(store);
1919
let resource: Resource = get(resourceStore);
2020

21-
resourceStore.subscribe(r => (resource = r));
22-
2321
let value: T | undefined = resource.get(property) as T;
2422
const subscriptions = new Set<ValueSubscriber<T>>();
2523
let subscribedToStore = false;
@@ -85,5 +83,11 @@ export const getValue = <T extends JSONValue = JSONValue>(
8583
},
8684
};
8785

86+
resourceStore.subscribe(r => {
87+
value = r.get(property) as T;
88+
resource = r;
89+
notifySvelteChange();
90+
});
91+
8892
return writable;
8993
};

0 commit comments

Comments
 (0)