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

[Bug]: Incompatible with Svelte 5 (pre-release) #158

Open
1 task
anowell opened this issue Apr 28, 2024 · 2 comments
Open
1 task

[Bug]: Incompatible with Svelte 5 (pre-release) #158

anowell opened this issue Apr 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@anowell
Copy link

anowell commented Apr 28, 2024

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

Importing a chartjs component (e.g. Bar) with Svelte 5 ([email protected]) yields this error message:

Your application, or one of its dependencies, imported from 'svelte/internal', which was a private module used by Svelte 4 components that no longer exists in Svelte 5. It is not intended to be public API. If you're a library author and you used 'svelte/internal' deliberately, please raise an issue on https://github.com/sveltejs/svelte/issues detailing your use case.

I haven't looked any further than simply confirming the import in this library:

import {
SvelteComponent,
bubble,
listen,
current_component,
} from 'svelte/internal';

Reproduction

[did not create shareable repro - merely confirmed svelte/internal is import]

chart.js version

4.4.2

svelte-chartjs version

3.1.5

Possible solution

No response

@anowell anowell added the bug Something isn't working label Apr 28, 2024
@shahedsalehi
Copy link

I just updated my project to svelte [email protected] and I encountered the same issue.

@anowell
Copy link
Author

anowell commented May 7, 2024

I've implemented a fix here: anowell@155042f

It's basically a rewrite of src/util/svelte.ts to work directly with the DOM, and then changes to the base Chart component to setup event listeners more explicitly.

It's certainly a breaking change, and I don't know that it's "correct", but it seems to work, still supports attaching event listeners (tested on the Bar chart storybook story), and I think it cleans them up. And I didn't mean to bump so many devDependencies, but I'm several years removed from the frontend dev tooling ecosystem so might have run a few too many unneeded pnpm commands.

From here, what it would take for this repo/package to support Svelte 5? Is it a new version? Should we wait for Svelte 5 to release? Is there an expectation of Svelte 4 compatibility? Is there some glaring issue with the implementation? Is there some other testing expectation I've completely overlooked? I could put together a PR if the missing pieces are relatively small, or I'm happy to have someone steal whatever they need from my change to put together a better solution.

Fwiw, I'm currently using it in a prototype with no intent to maintain beyond that prototype, so I advise against using my fork for anything beyond experimenting/testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants