Scheduler - Add safety guards for Angular SSR and Draggable disposal#33425
Open
aleksei-semikozov wants to merge 1 commit intoDevExpress:26_1from
Open
Scheduler - Add safety guards for Angular SSR and Draggable disposal#33425aleksei-semikozov wants to merge 1 commit intoDevExpress:26_1from
aleksei-semikozov wants to merge 1 commit intoDevExpress:26_1from
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds defensive guards to prevent runtime errors during Angular server-side rendering (SSR) and during Draggable teardown, improving robustness in non-standard lifecycle/SSR scenarios.
Changes:
- Guard
Draggable’s_stopAnimator()to avoid callingstop()on an uninitialized animator. - Add a null-check in Angular SSR rendering to avoid accessing properties on a missing rendered root element.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/devextreme/js/__internal/m_draggable.ts | Makes animator stopping tolerant to cases where _scrollAnimator is not available. |
| packages/devextreme-angular/src/server/render.ts | Adds a guard for SSR rendering when renderToString yields no root node. |
| temp.innerHTML = renderToString(el); | ||
|
|
||
| const mainElement = temp.childNodes[0]; | ||
| if (!mainElement) { |
There was a problem hiding this comment.
When renderToString(el) returns an empty string, this early return leaves container.innerHTML unchanged (potentially stale from a previous render). Consider clearing container.innerHTML (and returning) in this branch to align with renderIntoContainer's jsx === null handling and ensure consistent SSR output.
Suggested change
| if (!mainElement) { | |
| if (!mainElement) { | |
| container.innerHTML = ''; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.