diff --git a/CHANGELOG.md b/CHANGELOG.md index 54b00a9..bac4b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## [Unreleased] +## 5.0.1 +### Fixed +* fix(StandardMenu): appLimit must return a value > 0 + ## 5.0.0 ### Fixed * fix apps's order in the standard menu diff --git a/appinfo/info.xml b/appinfo/info.xml index f98f716..0944305 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -30,7 +30,7 @@ Notice Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**. In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/). ]]> - 5.0.0 + 5.0.1 agpl Simon Vieille SideMenu diff --git a/src/menus/StandardMenu.vue b/src/menus/StandardMenu.vue index 5e817ee..fb16b59 100644 --- a/src/menus/StandardMenu.vue +++ b/src/menus/StandardMenu.vue @@ -142,7 +142,7 @@ const appLimit = () => { }) } - return Math.floor((body.offsetWidth - size) / 70) + return Math.max(0, Math.floor((body.offsetWidth - size) / 70)) } const makeStyle = (app) => { @@ -158,6 +158,11 @@ const computeLists = () => { popoverAppList.value = appList.value.slice(appLimit()).sort((a, b) => a.order - b.order) } +const reComputeLists = (delay) => { + window.clearTimeout(resizeTimeout) + resizeTimeout = window.setTimeout(computeLists, delay || 100) +} + onMounted(async () => { const config = await configStore.getConfig() @@ -169,10 +174,7 @@ onMounted(async () => { setApps(await navStore.getCoreApps()) - window.addEventListener('resize', () => { - window.clearTimeout(resizeTimeout) - resizeTimeout = window.setTimeout(computeLists, 100) - }) + window.addEventListener('resize', reComputeLists) })