fix(client): タイミングによっては tag-cloud でエラーが発生するのを修正

This commit is contained in:
syuilo 2022-07-20 20:00:35 +09:00
parent e83dd90e07
commit 716cb23acb
1 changed files with 20 additions and 18 deletions

View File

@ -25,6 +25,7 @@ let tagsEl = $ref<HTMLElement | null>(null);
let width = $ref(300); let width = $ref(300);
watch($$(available), () => { watch($$(available), () => {
try {
window.TagCanvas.Start(idForCanvas, idForTags, { window.TagCanvas.Start(idForCanvas, idForTags, {
textColour: '#ffffff', textColour: '#ffffff',
outlineColour: tinycolor(computedStyle.getPropertyValue('--accent')).toHexString(), outlineColour: tinycolor(computedStyle.getPropertyValue('--accent')).toHexString(),
@ -42,6 +43,7 @@ watch($$(available), () => {
stretchX: 0.8, stretchX: 0.8,
stretchY: 0.8, stretchY: 0.8,
}); });
} catch (e) {}
}); });
onMounted(() => { onMounted(() => {
@ -58,7 +60,7 @@ onMounted(() => {
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
window.TagCanvas.Delete(idForCanvas); if (window.TagCanvas) window.TagCanvas.Delete(idForCanvas);
}); });
defineExpose({ defineExpose({