Move reactive config part into session state

This PR moves the signer "clones" the signer property from the `Config`
object into the `session` state, to allow Svelte reactivity, e.g. in the
Testnet Faucet, where we rely on `config.signer` but since it only
changes when the `Config` object in `App.svelte` changes we can't react
on it.

For now I only cloned the signer property, if we see in the future that
there are other properties that need to change with session we can add
them.

Signed-off-by: Sebastian Martinez <sebastinez@me.com>
Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Sebastian Martinez
2022-02-02 15:25:58 +01:00
committed by Alexis Sellier
parent eb3b683935
commit e3de337769
5 changed files with 71 additions and 42 deletions
+1 -2
View File
@@ -17,7 +17,6 @@
export let session: Session | null;
export let config: Config;
let sessionButton: HTMLElement | null = null;
let sessionButtonHover = false;
let mobileNavbarDisplayed = false;
@@ -182,7 +181,7 @@
{/if}
</span>
<button class="address outline small" bind:this={sessionButton}
<button class="address outline small"
on:click={() => disconnectWallet(config)}
on:mouseover={() => sessionButtonHover = true}
on:focus={() => sessionButtonHover = true}