From deecd2cb99b2d953babb9e611ac7ba9a4e718b40 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Thu, 31 Aug 2023 17:42:59 -0700
Subject: fix(page): user identity getter

---
 src/routes/+page.svelte | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'src/routes/+page.svelte')

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 6235fa58..cfcf016a 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -1,12 +1,13 @@
 <script lang="ts">
 	import { onMount } from 'svelte';
-	import { userIdentity } from '$lib/AniList/identity';
+	import { userIdentity as getUserIdentity } from '$lib/AniList/identity';
 	import AnimeList from '$lib/List/Due/AnimeList.svelte';
 	import MangaList from '$lib/List/Due/MangaList.svelte';
 	import displayUnresolved from '../stores/displayUnresolved';
 	import closeAnimeByDefault from '../stores/closeAnimeByDefault';
 	import closeMangaByDefault from '../stores/closeMangaByDefault';
 	import UpcomingAnimeList from '$lib/List/UpcomingAnimeList.svelte';
+	import userIdentity from '../stores/userIdentity';
 
 	export let data;
 
@@ -18,8 +19,12 @@
 
 	onMount(async () => {
 		if (data.user !== undefined) {
-			currentUserIdentity = await userIdentity(data.user);
-			currentUserIdentity.name = `(${currentUserIdentity.name})`;
+			if ($userIdentity === '') {
+				userIdentity.set(JSON.stringify(await getUserIdentity(data.user)));
+			}
+
+			currentUserIdentity = JSON.parse($userIdentity);
+			currentUserIdentity.name = currentUserIdentity.name;
 		}
 	});
 </script>
-- 
cgit v1.2.3

