-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Route infos not reloading #292
Comments
Upon further thinking: I guess
|
It seems there’s a bit of an issue with nested folders. Specifically: When I place the pages in |
I generate a navigation component from
vue-router/auto/routes
.When modifying a
<route>
block, I can see the update callbacks working (e.g. inextendRoute
) yet most of the time my app is not properly refreshed. Strangely rarely it seems to work with no visible explanation.I have a very trivial repro for you here:
https://github.com/jods4/unplugin-router-bug
Below is a video demonstrating the bug and a bit of debugging from my part.
The change handler works (albeit
updatePage
is called twice for a single save event... maybe a missed opportunity to debounce FS events), and internal structures look updated alright.It seems to me that the problem is: no code notifies Vite that the virtual module was changed.
And after a bit of manual calls to
server.invalidate("vue-router/auto/routes")
andserver.reload()
it actually works!I observe though that it works forever which kind of hints at why it sometimes persistently works in my project... Looks like the virtual file remains invalidated, maybe there's a missing call to tell Vite the file has been re-"validated" and should be cached?
2024-01-09_01-18-07.mp4
Side notes from my exploration of the source code for this issue:
getRouteBlock
takes a file path as input and reads it from disk, although its only callerwriteRouteInfoToNode
already has the contents in a string (passed toextractDefinePageNameAndPath
). Looks like unneeded I/O.extractDefinePageNameAndPath
only returnsname
andpath
? The docs make it sounds like you can usedefinePage
for any purpose, like<route>
block:The text was updated successfully, but these errors were encountered: