[refactor] performance improvements
This commit is contained in:
@@ -73,6 +73,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let charImages: string[] = [];
|
let charImages: string[] = [];
|
||||||
|
let IconRounded = false
|
||||||
|
|
||||||
const unsub = DataBase.subscribe((db) => {
|
const unsub = DataBase.subscribe((db) => {
|
||||||
let newCharImages: string[] = [];
|
let newCharImages: string[] = [];
|
||||||
@@ -82,6 +83,9 @@
|
|||||||
if (!isEqual(charImages, newCharImages)) {
|
if (!isEqual(charImages, newCharImages)) {
|
||||||
charImages = newCharImages;
|
charImages = newCharImages;
|
||||||
}
|
}
|
||||||
|
if(IconRounded !== db.roundIcons){
|
||||||
|
IconRounded = db.roundIcons
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onDestroy(unsub);
|
onDestroy(unsub);
|
||||||
@@ -117,7 +121,7 @@
|
|||||||
}}
|
}}
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<SidebarAvatar src={getCharImage($DataBase.characters[i].image, "plain")} size="56" />
|
<SidebarAvatar src={getCharImage($DataBase.characters[i].image, "plain")} size="56" rounded={IconRounded} />
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
||||||
@@ -132,7 +136,7 @@
|
|||||||
}}
|
}}
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<SidebarAvatar size="56" src="https://via.placeholder.com/150" />
|
<SidebarAvatar size="56" src="https://via.placeholder.com/150" rounded={IconRounded} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if editMode}
|
{#if editMode}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { DataBase } from "src/ts/database";
|
export let rounded:boolean
|
||||||
|
|
||||||
export let src:string|Promise<string>;
|
export let src:string|Promise<string>;
|
||||||
export let size = "22";
|
export let size = "22";
|
||||||
</script>
|
</script>
|
||||||
@@ -13,7 +12,7 @@
|
|||||||
style:width={size + "px"}
|
style:width={size + "px"}
|
||||||
style:height={size + "px"}
|
style:height={size + "px"}
|
||||||
style:minWidth={size + "px"}
|
style:minWidth={size + "px"}
|
||||||
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons}
|
class:rounded-md={!rounded} class:rounded-full={rounded}
|
||||||
/>
|
/>
|
||||||
{:then img}
|
{:then img}
|
||||||
<img
|
<img
|
||||||
@@ -22,7 +21,7 @@
|
|||||||
style:width={size + "px"}
|
style:width={size + "px"}
|
||||||
style:height={size + "px"}
|
style:height={size + "px"}
|
||||||
style:minWidth={size + "px"}
|
style:minWidth={size + "px"}
|
||||||
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons}
|
class:rounded-md={!rounded} class:rounded-full={rounded}
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
/>
|
/>
|
||||||
{/await}
|
{/await}
|
||||||
@@ -32,7 +31,7 @@
|
|||||||
style:width={size + "px"}
|
style:width={size + "px"}
|
||||||
style:height={size + "px"}
|
style:height={size + "px"}
|
||||||
style:minWidth={size + "px"}
|
style:minWidth={size + "px"}
|
||||||
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons}
|
class:rounded-md={!rounded} class:rounded-full={rounded}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user