Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

fix(core): support swapping hydrated views in @for loops#53274

Closed
AndrewKushnir wants to merge 1 commit intoangular:mainangular/angular:mainfrom
AndrewKushnir:hydration_for_swapsAndrewKushnir/angular:hydration_for_swapsCopy head branch name to clipboard
Closed

fix(core): support swapping hydrated views in @for loops#53274
AndrewKushnir wants to merge 1 commit intoangular:mainangular/angular:mainfrom
AndrewKushnir:hydration_for_swapsAndrewKushnir/angular:hydration_for_swapsCopy head branch name to clipboard

Conversation

@AndrewKushnir
Copy link
Contributor

This commit fixes an issue where swapping hydrated views was not possible in the new control flow repeater. The problem was caused by the fact that an internal representation of a view had no indication that hydration is completed and further detaching/attaching should work in a regular (non-hydration) mode. This commit adds a logic that resets a pointer to a dehydrated content and we use this as an indication that the view is swtiched to a regular mode.

Resolves #53163.

PR Type

What kind of change does this PR introduce?

  • Bugfix

Does this PR introduce a breaking change?

  • Yes
  • No

@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release core: hydration labels Nov 30, 2023
@ngbot ngbot bot modified the milestone: Backlog Nov 30, 2023
@AndrewKushnir
Copy link
Contributor Author

AndrewKushnir commented Nov 30, 2023

This PR potentially replaces PR #53225.

@AndrewKushnir
Copy link
Contributor Author

Exploratory presubmit.

packages/platform-server/test/hydration_spec.ts Outdated Show resolved Hide resolved

Choose a reason for hiding this comment

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

With this new condition I think that we can now change the implementation of the ViewContainerRef so the insert operations go through the shouldAddViewToDom logic - currently the insert operation has this value hard-coded to true and it means that those 2 operations (create vs. create + insert) have different logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pkozlowski-opensource thanks for the review!

I believe you refer to this code, where true indicates that the contents of a view should always be inserted:

override insert(viewRef: ViewRef, index?: number): ViewRef {
return this.insertImpl(viewRef, index, true);
}

I think that code is still correct. The createComponent and createEmbeddedView functions go through the insertImpl function and pass that flag based on what shouldAddViewToDom returns. For explicit insert calls, always inserting the content looks like a correct thing to do. Please let me know if I'm missing something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI, we'll proceed with the merge and I'd be happy to make extra changes in a followup PR once we discuss this more.

Choose a reason for hiding this comment

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

Yep, let's discuss more in the follow-up PR!

This commit fixes an issue where swapping hydrated views was not possible in the new control flow repeater. The problem was caused by the fact that an internal representation of a view had no indication that hydration is completed and further detaching/attaching should work in a regular (non-hydration) mode. This commit adds a logic that resets a pointer to a dehydrated content and we use this as an indication that the view is swtiched to a regular mode.

Resolves angular#53163.
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

LGTM

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 1, 2023
@dylhunn
Copy link
Contributor

dylhunn commented Dec 1, 2023

This PR was merged into the repository by commit 82609d4.

dylhunn pushed a commit that referenced this pull request Dec 1, 2023
This commit fixes an issue where swapping hydrated views was not possible in the new control flow repeater. The problem was caused by the fact that an internal representation of a view had no indication that hydration is completed and further detaching/attaching should work in a regular (non-hydration) mode. This commit adds a logic that resets a pointer to a dehydrated content and we use this as an indication that the view is swtiched to a regular mode.

Resolves #53163.

PR Close #53274
@dylhunn dylhunn closed this in 82609d4 Dec 1, 2023
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 1, 2024
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…3274)

This commit fixes an issue where swapping hydrated views was not possible in the new control flow repeater. The problem was caused by the fact that an internal representation of a view had no indication that hydration is completed and further detaching/attaching should work in a regular (non-hydration) mode. This commit adds a logic that resets a pointer to a dehydrated content and we use this as an indication that the view is swtiched to a regular mode.

Resolves angular#53163.

PR Close angular#53274
rlmestre pushed a commit to rlmestre/angular that referenced this pull request Jan 26, 2024
…3274)

This commit fixes an issue where swapping hydrated views was not possible in the new control flow repeater. The problem was caused by the fact that an internal representation of a view had no indication that hydration is completed and further detaching/attaching should work in a regular (non-hydration) mode. This commit adds a logic that resets a pointer to a dehydrated content and we use this as an indication that the view is swtiched to a regular mode.

Resolves angular#53163.

PR Close angular#53274
amilamen pushed a commit to amilamen/angular that referenced this pull request Jan 26, 2024
…3274)

This commit fixes an issue where swapping hydrated views was not possible in the new control flow repeater. The problem was caused by the fact that an internal representation of a view had no indication that hydration is completed and further detaching/attaching should work in a regular (non-hydration) mode. This commit adds a logic that resets a pointer to a dehydrated content and we use this as an indication that the view is swtiched to a regular mode.

Resolves angular#53163.

PR Close angular#53274
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime core: hydration target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elements removed from DOM using @for and SSR

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.