-
Notifications
You must be signed in to change notification settings - Fork 156
Revert toggle directive to use afterNextRender and update tests to wait for rendering #16430
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
Closed
Copilot
wants to merge
6
commits into
mvenkov/do-not-use-changedetection-to-update-host-bindings-in-toggle-directive
from
copilot/sub-pr-16429
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e655786
Initial plan
Copilot 8bbe7d5
fix: replace afterNextRender with setTimeout and add tick() to tests
Copilot e97d156
fix: use double detectChanges to ensure host bindings update
Copilot 049fa50
Fix toggle directive with requestAnimationFrame and update tests with…
Copilot c67732f
Revert to afterNextRender and convert toggle tests to async/await
Copilot c1fde5a
Revert toggle directive to use afterNextRender and update tests to wa…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Calling
detectChanges()twice is a code smell that suggests relying on implementation details of Angular's change detection. Consider usingApplicationRef.tick()or restructuring the code to avoid needing multiple synchronous change detection cycles. If this is truly necessary, the comment should explain why two calls are needed (what happens after the first that requires a second) rather than just stating what the code does.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
I really do not like this and it breaks again the auto position strategy. What you need to do is to fix the failing tests. Before the change in #16429 there were many test which expects toggle target to exist right after
toggle.openis called. This is not true after the change in #16429. What is needed is to make the failing test to wait until toggle target is visible. This is what you need to do.Update your PR and fix the failing test by making them wait as needed.