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

Nested yield-slot from block-slot #57

Open
janmisek opened this issue Jun 15, 2018 · 2 comments
Open

Nested yield-slot from block-slot #57

janmisek opened this issue Jun 15, 2018 · 2 comments

Comments

@janmisek
Copy link

Should following usecase work ?

  {{#block-slot 'row' as |user|}}

    {{#packages/commons/grid/components/row/grid-row-cmp}}

      {{packages/commons/grid/components/column/string-column-body-cmp value=user.id}}
      {{packages/commons/grid/components/column/user-column-body-cmp user=user}}

      {{#yield-slot 'actions' (block-params user)}}
        {{yield}}
      {{/yield-slot}}

    {{/packages/commons/grid/components/row/grid-row-cmp}}

  {{/block-slot}}

All components in nesting chain has SlotsMixin applied. Yielded slot actions is not propagated upwards.

@janmisek janmisek changed the title Nested yield from block-slot Nested yield-slot from block-slot Jun 15, 2018
@andrewfan
Copy link

@janmisek does not work out of the box, the simplest solution is to make childViews know the slots of its parents

try to do something like

SlotsMixin.reopen({
    didInsertElement() {
      this._super(...arguments);
      const parentWithSlots = this.nearestOfType(SlotsMixin);

      if (parentWithSlots) {
        get(this, '_slots').addObjects(get(parentWithSlots, '_slots'));
      }
    }
});

@janmisek
Copy link
Author

janmisek commented Jul 27, 2018

Or what I found out to be working also is to place yield for block-slot itself Is it supported solution ?

  {{#block-slot 'row' as |user|}}
     
    {{!-- extra yield in block-slot --}}
    {{yield}} 

    {{#packages/commons/grid/components/row/grid-row-cmp}}

      {{packages/commons/grid/components/column/string-column-body-cmp value=user.id}}
      {{packages/commons/grid/components/column/user-column-body-cmp user=user}}

      {{#yield-slot 'actions' (block-params user)}}
        {{yield}}
      {{/yield-slot}}

    {{/packages/commons/grid/components/row/grid-row-cmp}}

  {{/block-slot}}

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

2 participants