From 12596531a505dc5645188ef55044c18cba43cc46 Mon Sep 17 00:00:00 2001 From: William Moore Date: Sat, 1 Jul 2023 22:00:11 -0500 Subject: [PATCH] Update to properly retreive stored spells --- src/Place.ts | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Place.ts b/src/Place.ts index dae8a87..6dc5370 100644 --- a/src/Place.ts +++ b/src/Place.ts @@ -8,13 +8,6 @@ export class Place extends LitElement { @property() getCurrentSpell: any = null; - - constructor() { - super(); - const storedSpells = JSON.parse(localStorage.getItem(this.location) ?? '[]'); - this.spells = storedSpells; - } - static get properties() { return { location: { @@ -58,13 +51,16 @@ export class Place extends LitElement { ]; override render() { + const storedSpells = JSON.parse(localStorage.getItem(this.location) ?? '[]'); + this.spells = storedSpells; + return html` -
-

${this.location}

-
- ${this.spells.sort(spellSort).map(spell => spell ? html`` : '')} +
+

${this.location}

+
+ ${this.spells.sort(spellSort).map(spell => spell ? html`` : '')} +
-
`; } }