Open RobertSasak opened 3 months ago
I'll look abt this
hi @RobertSasak Does this mean that when I access "/shop1" it is logged? Or are you talking about "/:id is also generated"?
I run vite to command to produce static pages. ssgParams define only one page to be generated. It has id="shop1". However actual route get called twice. First time with a id=":id" and second time with id="shop1".
Only one static page is actually produced on the disk(shop1.html). However during my test I also saw ":id.html" created on the disk. I am not sure how to reproduce it.
hmm... Looking at the code, it does not seem to be generated @RobertSasak
Hi @RobertSasak
This is a known issue. We may fix it.
@watany-dev @sor4chi @nakasyou @usualoma Do you have any idea?
Thank you for following up this issue. I don't think it is necessary to spend energy on it as there is a simple workaround for it. I expected it will be fixed onced the question whether SSG should be middleware or not.
const id = c.req.param('id')
if (id==':id') {
return c.html('Ignored', 500) // https://github.com/honojs/hono/issues/3088
}
When I implemented this, I couldn't find how to resolve this.
However, application users can access /shops/:id
when it isn't on SSG, so I think there is no problem.
I have an idea.
What do you think about allowing ssgParams
to response params as JSON when request is for SSG?
In this solution, it will be returned early, so after handler will not be called. But we must set disableSSG
and onlySSG
before ssgParams
, it may be breaking change.
What version of Hono are you using?
4.4.11
What runtime/platform is your app running on?
NodeJS
What steps can reproduce the bug?
What is the expected behavior?
It is expected to log
What do you see instead?
Additional information
Route is called twice instead of once. First time the route is called the parameter id is not replaced with the actual value but stays ":id".
I think it might be related to https://github.com/honojs/hono/issues/2175