fix: ssr compatibility (#DS-3964)#1108
Merged
Merged
Conversation
|
Visit the preview URL for this PR (updated for commit e0781e2): https://koobiq-next--prs-1108-gkfgfc4n.web.app (expires Mon, 17 Nov 2025 13:43:27 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c |
9b4d665 to
4c5aab9
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds Server-Side Rendering (SSR) compatibility to multiple components by ensuring browser-specific APIs are not accessed during SSR. The changes include:
- Adding an
isFunctionutility to check for DOM API availability - Wrapping DOM API calls with SSR-safe checks
- Deferring browser-specific operations using
afterNextRender
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/components/core/utils/utils.ts | Adds new isFunction utility for checking if a value is a function |
| packages/components/core/option/option.ts | Adds SSR checks to getHeight() and renames element to elementRef for consistency |
| packages/components/tree/tree-selection.component.ts | Adds SSR compatibility check in getHeight() method |
| packages/components/tree/tree-option.component.ts | Adds SSR compatibility check in getHeight() method and @docs-private annotation |
| packages/components/list/list-selection.component.ts | Adds SSR compatibility checks in getHeight() methods for both selection and option components |
| packages/components/navbar/navbar.component.ts | Adds SSR compatibility check in width getter |
| packages/components/scrollbar/scrollbar.directive.ts | Refines ESLint disable comments to be more specific |
| packages/components/filter-bar/pipes/base-pipe.ts | Defers isMac() call to afterNextRender and improves documentation |
| packages/components/filter-bar/pipes/pipe-title.ts | Moves MutationObserver initialization to afterNextRender for SSR compatibility |
| packages/components/modal/modal-util.ts | Makes document parameter optional and adds conditional checks for SSR |
Comments suppressed due to low confidence (1)
packages/components/filter-bar/pipes/pipe-title.ts:92
- The
mutationSubscriptionmay beEMPTYwhenngOnDestroyis called if the component is destroyed beforeafterNextRenderexecutes (SSR scenario). WhileSubscription.EMPTY.unsubscribe()is safe, the code assumes subscription is initialized. Consider adding a nullish check or ensuringmutationSubscriptionis properly initialized.
this.mutationSubscription.unsubscribe();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NikGurev
approved these changes
Nov 12, 2025
lskramarov
approved these changes
Nov 12, 2025
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.