use_navigate or expect_context::<Store<T>> cannot be used under island #3601
Answered
by
gbj
tqq1994516
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
gbj
Feb 14, 2025
Replies: 1 comment 9 replies
-
Hard to tell without seeing your code, but you want to keep in mind that the context on the server is not copied to the client, so if you use it in an island that can panic. If you want to pass data to an island, you’d need to use a Resource
…On Wed, Feb 12, 2025, at 10:13 PM, tqq1994516 wrote:
The `use_navigate` function or the `expect_context::<Store<T>>` function cannot be used under the island, and the compilation is normal, but the console error message is `Uncaught RuntimeError: unreachable` when the frontend loads wasm.
image.png (view on web) <https://github.com/user-attachments/assets/5c347d28-d1de-44ee-9ca2-8c84a504c058>
This is the front-end not interactive, and if I comment this part of the code everything works.
—
Reply to this email directly, view it on GitHub <#3601>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABVBTCLNOSL273DMEIQLOJD2PQZZ5AVCNFSM6AAAAABXBK6PGGVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXHE2TSNJYHE>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I were using islands, I would probably use the
ProtectedRoute
component for any protected routes and let the question of whether it's authorized or not be handled on the server. In general, the "islands" approach is about moving things back toward a more traditional multi-page/server-rendered application, while making it easy to opt into small interactive portions of the page. This is why, for example, the entire router isn't shipped to the client — once you enable client-side routing you pretty much need to compile all of every page into the WASM binary, which is what islands are trying to avoid. Since you'll need to go back to the server while navigating anyway, it usually makes the …