Skip to content

SMUI Bottom App Bar raises error when destroyed during resizing window. #690

Open
@okaluk

Description

@okaluk

Hello, first of all, really nice work and thanks for sharing it with us!

I started using this library for a small project and wanted to use the bottom-app-bar for my mobile view. I use a media query to check if my width is higher than 600px, if so, the bottom-app-bar is unmounted from the dom. actually, this throws an Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect').

I already found a fix for this in BottomAppBar.svelte:175:

return getElement()?.getBoundingClientRect().height;

i would like to pull request this, if you don't mind.

code example:

<script lang="ts">
  import { MediaQuery } from "svelte/reactivity";
  import BottomAppBar, {
    AutoAdjust,
  } from '@smui-extra/bottom-app-bar';

  let mobile = new MediaQuery('(max-width: 600px)');
</script>

{#if mobile.current}
  <BottomAppBar>
    <p> test bottom app bar </p>
  </BottomAppBar>
{:else}
  <p> test no bottom app bar </p>
{/if}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions