Skip to content

Commit

Permalink
Fix various issues with slots (#933)
Browse files Browse the repository at this point in the history
* WIP: initial set up and test

* WIP: check point

* don't print render for whitespace-only text nodes

* oops

* update whitespace in tests

* update whitespace in tests

* chore: changeset

* add missed updated test

* fix edge case

* chore: more descriptive comments

* chore: reformulate comments for clarity

* revert to initial code with more descriptive vars

* refactor

* parens around custom element slots for consistency

* update tests

* handle template strings

* ignore slots w dynamic names without parent expr

* update test

* fix test

* check point

* update tests

* WIP: handle default slots and text nodes better

* refactor: break things down into functions

* test: add tests and rename current ones

* chore: changeset

* save a poor man's RAM

* remove unnecessary use of pointers

* `processNestedSlotEntries` -> `generateEndSlotIndexes`

* make the linter happy

* fix https://github.com/withastro/astro/issues/8687

* use a special `renderSlotTemplate` func for slots

* test: update test

* test: add more complex nested slot expr test

* better positioning of comma between slot groups

* revert `renderSlotTemplate` function

* chore: more detailed changeset

* chore: update test

---------

Co-authored-by: Nate Moore <[email protected]>
Co-authored-by: Nate Moore <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2024
1 parent 56ace04 commit db13db9
Show file tree
Hide file tree
Showing 3 changed files with 479 additions and 222 deletions.
7 changes: 7 additions & 0 deletions .changeset/green-camels-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/compiler': minor
---

- Adds support for dynamic slots inside loops
- Fixes an issue where successive named slotted elements would cause a runtime error
- Fixes an issue in which if there was an implicit default slotted element next to named one, the former would get swallowed by the later.
Loading

0 comments on commit db13db9

Please sign in to comment.