This might have something to do with Automatic Static Optimization
Next.js documentation says:
Pages that are statically optimized by Automatic Static Optimization will be hydrated without their route parameters provided, i.e
querywill be an empty object ({}).