slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
33.49k stars 1.37k forks source link

Using onSlideEnter() causes error in existing slide deck #1723

Closed gureckis closed 4 months ago

gureckis commented 4 months ago

Describe the bug

I have a slide presentation which has loads a custom component in one of my slidse. This component is simple test just for debugging:

<script setup>
import { onSlideEnter } from '@slidev/client'

onSlideEnter(() => {
  console.log('start scrolling')
})

</script>

<template>
  <div><slot></slot></div>
</template>

which is to say a component that doesn't do much.

I reference it in my slides.md

<TestComponent><h1>My content</h1></TestComponent>

This results in an error on the console that looks like this

image

And the slide containing this component will not display. It might be unreleated but this seems to also causes any Monaco formatted code sections to not load correctly.

Commenting out the onSlideEnter( () => { console.log('start scrolling') } makes things work again.

Environment

KermanX commented 4 months ago

Sorry, I can't reproduce this on my machine. Does this still happen after restarting the Slidev server?

gureckis commented 4 months ago

i'm not sure i had a local theme that was behaving weird for some other reason. i think it seems to have gone away now.