1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00

fix: fix issue where live keys didn't fetch an initial value

This commit is contained in:
Ash Keel 2023-01-09 16:31:04 +01:00
parent d72b8834a3
commit 5f4a909017
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E

View file

@ -29,6 +29,7 @@ export function useLiveKeyString(key: string) {
useEffect(() => {
const subscriber: SubscriptionHandler = (v) => setData(v);
void client.getKey(key).then((value) => setData(value));
void client.subscribeKey(key, subscriber);
return () => {
void client.unsubscribeKey(key, subscriber);