Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support nested islands (alternative) #517

Closed

Conversation

blakechambers
Copy link

@blakechambers blakechambers commented Jul 16, 2022

This branch is an alternate to #459 that adds support for nested islands. As discussed, the way this change handles nested islands is to use an island context to track whether the component is within an island or not. This should address the problems mentioned in #168 and #178.

Additionally, this change has a second commit exposing a useWithinIsland component which would let components detect whether they are being loaded within an island. I'm not sure if the addition of this is a good fit for the framework long term. I could see it being used in cases where a component library (one specifically designed for fresh) would need to do different things on render e.g. modifications to <head>. Since there are likely pros and cons to this, I'm happy to split it into another PR so it can be discussed separately.

Future idea 💡 – I could also see a way that the island context could open a path to get the <Head> component working in the browser.

Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea with the context! I'll give this a proper review on Monday.

@blakechambers
Copy link
Author

blakechambers commented Aug 6, 2022

@lucacasonato I noticed the roadmap mentioned supporting anywhere in the tree.

I feel like the context approach (from this PR) to track island during render could still help to accomplish that goal, especially as a way to support indifferent usage of head between server side and client side.

However, in light of the roadmap goals, I was wondering if this PR needs any changes?

@marvinhagemeister
Copy link
Collaborator

Thanks for the PR! Apologies that we couldn't get it over the finish line. In the end we went with the approach in #1285 to support nested islands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants