rx-angular: ISR: Invalidate cache issue
### When we make an API request, we noticed that the library does not invalidate the cache.
https://www.rx-angular.io/docs/isr/on-demand-revalidation
server.post(
'/api/invalidate',
async (req, res) => await isr.invalidate(req, res)
`);`
When we compare the original files from https://github.com/rx-angular/rx-angular/blob/main/libs/isr/server with the files installed in node_modules, we noticed that there is a difference in the renderUrl() method in the installed files in node_modules (rx-angular-isr-server.mjs), compared to the file from https://github.com/rx-angular/rx-angular/blob/main/libs/isr/server/src/utils/render-url.ts
We suspect that there is an error in the renderUrl() method in the installed node_modules file rx-angular-isr-server.mjs. See the screenshots.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
My bad, that was the problem. I didn’t expect that SGR was enabled by default (for static routes) in Angular 18 when enabling SSR. I don’t think that’s a good idea for a default configuration… Thank you!
I would add this step in the documentation, because I fear I won’t be the only one with this problem as this is the default configuration Angular set when enabling SSR/SSG (in newest versions at least, SSG is relatively new in Angular).
Keep up the good work!, this library is a must have. I don’t understand why Angular doesn’t support ISR natively yet. Thank you again.
I’ve reproduced the bug as you said. The date is not updated in the HTML I get from the server. I have not set any route (no revalidate anywhere). This is the repository for testing this:
https://github.com/arturober/isr-test
Test with ng build && node dist/isr-test/server/server.mjs
Try just http://localhost:4000 and the bug is there, but add any path to the route (ex: http://localhost:4000/hello) and it works like it should.
Maybe I’m doing domething wrong, but it’s strange everything works ok for routes other than empty route.
Node version: v20.12.2
I can confirm this bug only when I try to invalidate the ‘/’ route. I get a confirmation that it’s been invalidated in the response and the docker logs (Urls: / were regenerated!), however I always get the old content. Other urls work as expected, or so it seems to me.
Edit: I’ve just updated to 18.1.0 (and Angular to 18.2.3) and still the same problem