Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spline not emitting click events after routing #213

Open
PatrickZimmerer opened this issue Oct 15, 2024 · 0 comments
Open

Spline not emitting click events after routing #213

PatrickZimmerer opened this issue Oct 15, 2024 · 0 comments

Comments

@PatrickZimmerer
Copy link

I built a minimal reproducible example here

Path to reproduce the error:

  1. Click on the spline => routes you to a new page and logs event to the console
  2. press back button on mouse / browser
  3. Click on the spline => routes you to a new page and logs event to the console
  4. press back button on mouse / browser
  5. Click on the spline => doesn't route to a new page and doesn't log the event to the console

Path to resolve the error:

  1. Leave the spline with your cursor
  2. Enter the spline with your cursor
  3. Click on the spline => now it works and it routes you to a new page and logs event to the console
    or
    Reload the page

This can be reproduced every time, the code is very simple as you will see in the home page that implements the spline, which is also the only code in this repo.

The spline just emits a random event which we react to

'use client';

import Spline, { SplineEvent } from '@splinetool/react-spline';
import { useRouter } from 'next/navigation';
export default function Home() {
	const router = useRouter();

	function onSplineMouseDown(e: SplineEvent) {
		console.log('button clicked', e);
		router.push('/test');
	}

	return (
		<div className="min-h-screen flex flex-col items-center justify-center">
			<h1 className="text-4xl mb-4">SPLINE PAGE</h1>
			<Spline
				onSplineMouseDown={onSplineMouseDown}
				scene="https://prod.spline.design/txU4v9QQq6G7PnCi/scene.splinecode"
			/>
		</div>
	);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant