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

perf(dev-cache): improve localhost markdown page navigation performance (when having 2,000+ pages) #2675

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

coffeephile
Copy link
Contributor

πŸ”— Linked issue

#2674

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves #2674

Navigating between markdown pages on localhost (dev server) is very slow when dealing with 2,000+ markdown pages.
(Please refer to linked issue for demo and reproduction)

By using cachedContents on localhost as well (not only during build time) this issue can be resolved.
In order to keep hot reload working, the cache gets flushed when a file change is detected.

I confirmed my fix to be working for my use case, however I'm not sure if I am breaking anything else in the process, so any advice or help is welcome.
This PR should be considered a first draft, rather than a perfect solution. πŸ™‡β€β™‚οΈ

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By removing the prerendering check, we are changing the behavior of the production environment too.
We should add back prerendering check and add logic to handle dev mode

src/module.ts Outdated Show resolved Hide resolved
src/runtime/server/storage.ts Outdated Show resolved Hide resolved
src/runtime/server/storage.ts Outdated Show resolved Hide resolved
@coffeephile
Copy link
Contributor Author

@farnabaz Many thanks for your swift review, much appreciated! πŸ™

I've implemented the changes you suggested, please check again πŸ™‡β€β™‚οΈ

Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM πŸ‘
Thanks

@farnabaz farnabaz merged commit 5672457 into nuxt:main Jun 25, 2024
2 checks passed
@coffeephile
Copy link
Contributor Author

Thank you! πŸ™πŸ˜Š

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

Successfully merging this pull request may close these issues.

Markdown page navigation slow on dev server when having multiple thousand md pages
2 participants