vikejs / vike

🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.
https://vike.dev
MIT License
3.86k stars 334 forks source link

Use `throw render()` / `throw redirect()` inside React/Vue/Solid components #1707

Open brillout opened 1 week ago

brillout commented 1 week ago

Description

In principle, it should be possible to use throw render() and throw redirect() inside UI components.

For this to work, vike-{react,vue,solid} need to catch the exception and then re-throw it inside the onRenderHtml()/onRenderClient() hook, so that the exception propagates to Vike.

Contribution welcome.

brillout commented 5 days ago

Deprioritizing, as per https://github.com/vikejs/vike-react/pull/123#issuecomment-2196236446.