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

Fills ordered by least recently mounted #35

Open
maxkostow opened this issue Jun 13, 2018 · 3 comments
Open

Fills ordered by least recently mounted #35

maxkostow opened this issue Jun 13, 2018 · 3 comments

Comments

@maxkostow
Copy link

Issue:

Fills are rendered in reverse order that they are mounted

Expected:

Fills are rendered in their order in the react tree

Example:

https://conscious-violet.glitch.me/
See that the order that you toggle survey/news affects their button order in the toolbar

I'm happy to open a PR if you can think of a way to calculate the order. My only thought was to base it on a timestamp/global counter since I don't think components have access to their siblings but that seems like a poor solution.

@gorangajic
Copy link

@maxkostow have you figured this one out? I want to mount only the first component in a tree

<Slot name="modal">
    {slots => slots[0] || null}
</Slot>

@maxkostow
Copy link
Author

I have not; my workaround has been to render all fills in their place and include a prop on the fill child (or wrapper) that prevents it from rendering anything.

In your example, that might looks something like

<Slot>
  {fills => fills.find(fill => !fill.props.hidden)}
</Slot>

@camwest
Copy link
Owner

camwest commented Sep 7, 2018

@maxkostow I'd be happy to accept PRs on this, but I don't have the bandwidth to figure it out myself at the moment.

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

No branches or pull requests

3 participants