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

fix: rerender components with conditional slots when slotting elements after initialization #3871

Conversation

jcfranco
Copy link
Member

@jcfranco jcfranco commented Jan 6, 2022

Related Issue: #3686

Summary

This PR updates components that were already using getSlotted for conditionally rendering their named slots to use the interface and utils from the conditionalSlot.ts util.

Notable changes

  1. Refactored the conditional slot helpers to ensure components rerender when elements are appended after initialization
  2. Enhanced the slots test helper to help test conditional rendering
  3. Refactored calcite-panel's footer slot rendering to render both slots†

Reasoning for 3:

@github-actions github-actions bot added this to the Sprint 01/03 - 01/14 milestone Jan 6, 2022
@github-actions github-actions bot added the bug Bug reports for broken functionality. Issues should include a reproduction of the bug. label Jan 6, 2022
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

Nice!

@jcfranco jcfranco marked this pull request as ready for review January 13, 2022 01:36
@jcfranco jcfranco requested a review from a team as a code owner January 13, 2022 01:36
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

Looks good!

@jcfranco
Copy link
Member Author

Existing test failure is unrelated:

Summary of all failing tests
FAIL src/components/calcite-dropdown/calcite-dropdown.e2e.ts (69.154 s)
   calcite-dropdown  opens the dropdown with click, enter, or space  opens when dropdown-trigger is an action

    expected event "calciteDropdownOpen" to have been called 1 times, but was called 2 times

      828 |       await page.waitForChanges();
      829 |       expect(await dropdownWrapper.isVisible()).toBe(true);
    > 830 |       expect(calciteDropdownOpen).toHaveReceivedEventTimes(1);
          |                                   ^
      831 |     });
      832 |   });
      833 |

      at Object.<anonymous> (src/components/calcite-dropdown/calcite-dropdown.e2e.ts:830:35)

cc @Elijbet

All other checks are ✅. Merging!

@jcfranco jcfranco merged commit 2ec9848 into master Jan 13, 2022
@jcfranco jcfranco deleted the jcfranco/3686-rerender-conditionally-slotted-components-after-slotting branch January 13, 2022 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports for broken functionality. Issues should include a reproduction of the bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants