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

Pass transition directives onto components #838

Merged
merged 1 commit into from
Jul 27, 2023
Merged

Conversation

matthewp
Copy link
Contributor

Changes

  • Adds the data-astro-transition-scope var into components as well. This is needed so they can pass the result down to children, if they want.

Testing

  • New test added

Docs

  • N/A

@changeset-bot
Copy link

changeset-bot bot commented Jul 26, 2023

🦋 Changeset detected

Latest commit: f3a4bda

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

source: `<Component class="bar" transition:animate="morph"></Component>`,
filename: "/projects/app/src/pages/page.astro",
want: want{
code: `${$$renderComponent($$result,'Component',Component,{"class":"bar","data-astro-transition-scope":($$renderTransition($$result, "", "morph", ""))})}`,
Copy link
Member

Choose a reason for hiding this comment

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

It's tough to understand the expected result. Are the parentheses needed in ($$renderTransition($$result, "", "morph", ""))})?

- ($$renderTransition($$result, "", "morph", ""))
+ $$renderTransition($$result, "", "morph", "")

It should yield the same result

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think our attribution expression code always wraps expressions with parens. Maybe we can change it? I don't know. I assume it's to protect against something... but what alludes me. Perhaps in case someone puts a statement inside of an expression, the parens make it into an expression? idk.

@matthewp matthewp merged commit 6b4873d into main Jul 27, 2023
5 checks passed
@matthewp matthewp deleted the forward-transition branch July 27, 2023 12:48
@43081j
Copy link
Contributor

43081j commented Jul 30, 2023

@matthewp you left an only: true in FYI so the tests in main are now skipping all of the other printer test cases 👀

have opened #841

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.

3 participants