Problem
When serve() has two page patterns that both provide a page (an app's override first, the framework's default second), deleting the app's file while the dev server runs makes that route answer 500 Internal Server Error until the server restarts. It should fall back to the next pattern's page, or 404 if none has it.
Components don't have this problem: deleting an app's override component while the server runs falls back to the framework's on the next request.
Reproduction (Stacks system tray, stx 0.2.733)
buddy dev:system-tray serves patterns: [<app>/resources/views/system-tray, <framework>/views/system-tray].
- Create
resources/views/system-tray/index.stxin the app (a copy of the framework's, with a marker). - Start the server.
GET /returns 200 with the app's marker. - Delete
resources/views/system-tray/while the server runs.GET /now returns 500 with the generic "Internal Server Error" body. - Restart the server with the file still absent.
GET /returns 200 with the framework's page (21,908 bytes, no marker).
So the framework page is resolvable. The route discovered at startup keeps pointing at the deleted file.
Expected
A .stx deletion under a pattern directory invalidates that route, and the next request resolves through the remaining patterns, as a server restart would. The watcher already sees the event: pattern directories are watched for cache invalidation.
Why it matters
Stacks apps now override framework pages by copying them into the app (buddy publish:view, stacksjs/stacks#3032). Removing an override to return to the framework's page is a normal step, and today it looks like the page broke.