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

Issue: Shiki Highlighter Instances Not Disposed During Hot Reloads #103

Open
dev-kraken opened this issue Jan 9, 2025 · 0 comments
Open

Comments

@dev-kraken
Copy link
Contributor

We have an issue where Shiki highlighter instances accumulate during hot reloads, leading to performance degradation. Console logs show: path /docs/*

Steps to Reproduce

  1. Start the development server (npm run dev).
  2. Modify a component using Shiki.
  3. Observe multiple instance creation warnings.

Expected Behavior

Shiki should be used as a singleton, with instances disposed of during hot reloads.

Actual Behavior

Multiple Shiki instances are created without disposal, resulting in warnings:

Shiki is supposed to be used as a singleton; consider refactoring your code...

Proposed Solution

Refactor to implement a singleton pattern for the Shiki highlighter instance, disposing of it only when necessary.

I will submit a pull request to address this issue soon.

dev-kraken added a commit to dev-kraken/motion-primitives that referenced this issue Jan 9, 2025
This commit addresses issue ibelick#103 by implementing a singleton pattern for the Shiki highlighter instance. It ensures that instances are reused and properly disposed of, preventing memory leaks and performance degradation during hot reloads.
dev-kraken added a commit to dev-kraken/motion-primitives that referenced this issue Jan 22, 2025
This commit addresses issue ibelick#103 by implementing a singleton pattern for the Shiki highlighter instance. It ensures that instances are reused and properly disposed of, preventing memory leaks and performance degradation during hot reloads.
@dev-kraken dev-kraken reopened this Jan 22, 2025
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