Two issues related to `staticFunctionMiddleware`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Start
Describe the bug
First
When prerender is disabled, staticFunctionMiddleware must be disabled as well, but right now it's partially disabled: Although no JSON files are created, but requests are still sent to the JSON, instead of the original server function.
Second
When spa is enabled, staticFunctionMiddleware must be enabled as well (as SPA is supposed to be static), but right now it's partially disabled, as described in the previous title.
Complete minimal reproducer
https://github.com/reza55n/tanstack-start-test
Steps to Reproduce the Bug
First
npm install
npm run build
npm run preview
In the browser, open http://localhost:4173/
Open devTools - Network
Navigate to Go about and then back to Go home
You see staticFunctionMiddleware must be disabled but it's partially disabled
(asks JSON which doesn't exist)
Second
Then:
Uncomment the line // spa: {enabled: true}, from vite.config.ts
npm run build
npm run preview
Repeat the navigation steps
You see staticFunctionMiddleware must be enabled but it's partially disabled as well
(asks JSON which doesn't exist)
Expected behavior
Explained above
Screenshots or Videos
No response
Platform
- Start Version: 1.168.32
- OS: Windows
- Browser: Chrome
- Browser Version: 150
- Bundler: Vite
- Bundler Version: 5.2.0
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the linked minimal repository using npm install, npm run build, and npm run preview. Start with vite.config.ts and compare the network requests when prerender is disabled versus when spa: {enabled: true} is enabled. Done means disabled prerender calls the original server function, while enabled SPA mode uses the expected static-function behavior without requesting missing JSON.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100