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[angular-gen2]: add angular 19 ssr e2e and fix hydration errors #3806

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

sidmohanty11
Copy link
Contributor

@sidmohanty11 sidmohanty11 commented Dec 30, 2024

Description

Fixes the hydration error thrown from angular for using ngComponentOutlet, adds angular-19-ssr to e2e and an example of how users can override fetch to use HTTP client from angular that should help in caching HTTP requests

Jira
https://builder-io.atlassian.net/browse/ENG-7946
https://builder-io.atlassian.net/browse/ENG-7945
https://builder-io.atlassian.net/browse/ENG-7665

Screenshot
If relevant, add a screenshot or two of the changes you made.

Copy link

changeset-bot bot commented Dec 30, 2024

⚠️ No Changeset found

Latest commit: 40407e4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

nx-cloud bot commented Dec 30, 2024

View your CI Pipeline Execution ↗ for commit 40407e4.

Command Status Duration Result
nx test @e2e/angular-19-ssr ✅ Succeeded 5m View ↗

☁️ Nx Cloud last updated this comment at 2025-01-09 11:34:19 UTC

}
return code;
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that we're not going to be hydrating ContentComponent moving forward? Does this mean that SSR effectively won't work for the SDK? Or just that Hydration is not performed, but SSR succeeds as intended?

Essentially, I'm curious if this change here will break any SDK features.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Content will be ssred but the ssred DOM structure won't be reused in the client and that will perform hydration again. This shouldn't break any SDK features but might affect site perf a bit

@@ -24,7 +24,7 @@ test.describe('Custom components', () => {
packageName,
sdk,
}) => {
test.skip(!['angular', 'react'].includes(sdk));
test.skip(!['angular-16', 'react'].includes(sdk));
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a wrong check: you're comparing a packageName (angular-16, etc.) to sdk (should always be angular for all 3 angular e2e servers)

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the case for many other checks changed in .spec.ts files in this PR.

Copy link
Contributor Author

@sidmohanty11 sidmohanty11 Jan 9, 2025

Choose a reason for hiding this comment

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

ahh my bad, I might have used replace all. Thanks for the catch, have updated them

@@ -718,6 +718,25 @@ const ANGULAR_COMPONENT_REF_UPDATE_TEMPLATE_SSR = () => ({
},
});

/**
* Angular doesn't support hydration for components created dynamically.
Copy link
Contributor

Choose a reason for hiding this comment

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

can you link to any docs or code that expands on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

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.

2 participants