Skip to content

Commit

Permalink
feat: remove useSafeOnMounted workaround
Browse files Browse the repository at this point in the history
Suspense + Animation issue was fixed vuejs/core#5844
  • Loading branch information
dankerow committed Oct 27, 2023
1 parent ab79374 commit 679dc42
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 40 deletions.
5 changes: 1 addition & 4 deletions src/components/Cursor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ const refreshItems = () => {
focusMouse(cursor, newTexts)
}
const rootElement = ref(null)
useSafeOnMounted(rootElement, async () => {
onMounted(() => {
if (ScrollTrigger.isTouch !== 1) {
const cursor = document.querySelector('#cursor') as HTMLElement
cursor.style.backgroundColor = 'transparent'
Expand Down Expand Up @@ -122,7 +120,6 @@ onNuxtReady(() => {
<template>
<div
id="cursor"
ref="rootElement"
class="border border-white pe-none position-fixed top-0 start-0 rounded-circle align-items-center justify-content-center"
:style="{ 'display': 'none', 'height': '0.8rem', 'width': '0.8rem', 'z-index': 5, 'mix-blend-mode': 'exclusion' }"
/>
Expand Down
7 changes: 2 additions & 5 deletions src/components/Gallery/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ const props = withDefaults(defineProps<Props>(), {
const imagesData: Ref<any[]> = ref(props.images)
const lightbox: Ref<PhotoSwipeLightbox|null> = ref(null)
const rootElement = ref<HTMLElement>()
useSafeOnMounted(rootElement, () => {
onMounted(() => {
if (!lightbox.value) {
lightbox.value = new PhotoSwipeLightbox({
gallery: rootElement.value.$el,
gallery: '.masonry-wall',
children: 'a',
pswpModule: () => import('photoswipe'),
wheelToZoom: true
Expand Down Expand Up @@ -73,7 +71,6 @@ watch(() => props.images, (newImages) => {

<template>
<masonry-wall
ref="rootElement"
:items="imagesData"
:column-width="columnWidth"
:min-columns="minColumns"
Expand Down
31 changes: 0 additions & 31 deletions src/composables/useSafeOnMounted.ts

This file was deleted.

0 comments on commit 679dc42

Please sign in to comment.