encointer / encointer-wallet-flutter

Encointer mobile wallet flutter implementation
https://encointer.org
Apache License 2.0
21 stars 15 forks source link

Unreliable storage subscriptions #186

Open clangenb opened 2 years ago

clangenb commented 2 years ago

I am subscribing to storage double-map values via polkadot-js-api. In some cases, there seems to be no subscription updates, depending on the operation performed in the pallet.

I could observe this so far for the ParticipantIndex

brenzi commented 2 years ago

I believe double map can't be subscribed with only the primary prefix. You can only subscribe to specific values, so insert doesn't trigger as it doesn't affect an existing value (only mutate would) I think this behavior you describe works as designed

brenzi commented 2 years ago

hmm, but the change from None to Some participant index should trigger, actually

clangenb commented 2 years ago

I have asked in substrate-technical, let's see if an answer comes. We are not too reliant on this anyhow. I also doubt if a subscription makes sens in some cases where we only occasionally get updates. It might be better to fetch the updates, when necessary.

brenzi commented 2 years ago

well, a reactive design relies on subscriptions, not polling. So I do prefer the current model