Skip to content

Conversation

@SkyZeroZx
Copy link
Contributor

@SkyZeroZx SkyZeroZx commented Nov 27, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from josephperrott November 27, 2025 16:17
@angular-robot angular-robot bot added the area: docs Related to the documentation label Nov 27, 2025
@ngbot ngbot bot added this to the Backlog milestone Nov 27, 2025
@SkyZeroZx SkyZeroZx force-pushed the docs/platform-helpers branch from 4e14e14 to cc67ee5 Compare November 27, 2025 16:33
@pullapprove pullapprove bot requested a review from atscott November 27, 2025 16:33
@JeanMeche JeanMeche requested review from alan-agius4 and thePunderWoman and removed request for atscott and josephperrott November 27, 2025 17:47
Copy link
Contributor

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

I am a bit hesitant to include details on isPlatformBrowser and isPlatformServer in the SSR guide. Historically, these have been considered an escape hatch, and developers should be not be relying on them heavily. A better, more idiomatic approach is to use DI to provide platform-specific implementations.

Furthermore, we must first document the recommended practices for overriding providers within the SSR documentation, as this is the preferred method that developers should follow.

@SkyZeroZx
Copy link
Contributor Author

I am a bit hesitant to include details on isPlatformBrowser and isPlatformServer in the SSR guide. Historically, these have been considered an escape hatch, and developers should be not be relying on them heavily. A better, more idiomatic approach is to use DI to provide platform-specific implementations.

Furthermore, we must first document the recommended practices for overriding providers within the SSR documentation, as this is the preferred method that developers should follow.

So to include this section, we should first add one about providing platform-specific implementations, and then introduce the section about the helpers.

While platform-specific implementations are generally preferred, I also think the helpers are necessary as a workaround when dealing with third-party libraries.

@JeanMeche
Copy link
Member

I've also chatted a bit with @thePunderWoman when you opened #64846. The idea is that those helpers are mostely not recommended and should be last resort solution (or escape hatch liek Alan is saying).

What we should be documenting are the alternatives (distinct providers, browser only apis life afterNextRender/afterRenderEffect etc. )

@SkyZeroZx SkyZeroZx force-pushed the docs/platform-helpers branch from cc67ee5 to b1efb17 Compare November 27, 2025 21:09
@SkyZeroZx SkyZeroZx changed the title docs: add platform detection helpers docs: add platform-specific implementation and helpers Nov 27, 2025
@SkyZeroZx
Copy link
Contributor Author

Updated with the recommendations, a section "Providing platform-specific implementations" has been added and the previously added section has been retained; a note has also been added indicating which option is recommended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs Related to the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants