summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-03-03 11:43:53 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-03-03 11:43:53 +0900
commit3066a133ac339bfbc0c1707b3c8c7af10ea2d082 (patch)
tree2028c3868b557ea034be8daa51e40acc8f95923a
parentNew Crowdin updates (#10114) (diff)
downloadsharkey-3066a133ac339bfbc0c1707b3c8c7af10ea2d082.tar.gz
sharkey-3066a133ac339bfbc0c1707b3c8c7af10ea2d082.tar.bz2
sharkey-3066a133ac339bfbc0c1707b3c8c7af10ea2d082.zip
fix(client): prevent null reference error
-rw-r--r--packages/frontend/src/components/global/MkStickyContainer.vue14
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/frontend/src/components/global/MkStickyContainer.vue b/packages/frontend/src/components/global/MkStickyContainer.vue
index 3f9c1bc353..44c02088da 100644
--- a/packages/frontend/src/components/global/MkStickyContainer.vue
+++ b/packages/frontend/src/components/global/MkStickyContainer.vue
@@ -32,11 +32,17 @@ const parentStickyBottom = inject<Ref<number>>(CURRENT_STICKY_BOTTOM, ref(0));
provide(CURRENT_STICKY_BOTTOM, $$(childStickyBottom));
const calc = () => {
- childStickyTop = parentStickyTop.value + headerEl.offsetHeight;
- headerHeight = headerEl.offsetHeight.toString();
+ // コンポーネントが表示されてないけどKeepAliveで残ってる場合などは null になる
+ if (headerEl != null) {
+ childStickyTop = parentStickyTop.value + headerEl.offsetHeight;
+ headerHeight = headerEl.offsetHeight.toString();
+ }
- childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight;
- footerHeight = footerEl.offsetHeight.toString();
+ // コンポーネントが表示されてないけどKeepAliveで残ってる場合などは null になる
+ if (footerEl != null) {
+ childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight;
+ footerHeight = footerEl.offsetHeight.toString();
+ }
};
const observer = new ResizeObserver(() => {