-
Notifications
You must be signed in to change notification settings - Fork 87
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
refactor: introduce SSR variable for platform checks #1080
Merged
Merged
Conversation
This file contains 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
dhhyi
added
refactoring
Refactoring of current code
community
Community contributions
labels
Mar 22, 2022
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
3 times, most recently
from
March 31, 2022 08:03
f4754bf
to
8245142
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
2 times, most recently
from
April 3, 2022 11:52
236b3b8
to
b83c9dd
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
from
April 17, 2022 20:35
b83c9dd
to
48a8305
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
from
April 21, 2022 14:26
48a8305
to
a02d847
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
from
May 2, 2022 07:43
a02d847
to
20b86e5
Compare
It seems like a nice improvement but we should introduce it with the next major version and not with a 2.x minor version. At least if there are no further objections. |
Good idea. I'll keep the branch up-to-date until then whenever it |
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
2 times, most recently
from
May 20, 2022 12:15
f1511da
to
160e531
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
from
June 6, 2022 09:22
add309b
to
c3cf255
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
from
June 21, 2022 15:32
c3cf255
to
02bc5ee
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
from
June 27, 2022 14:06
02bc5ee
to
18a00ce
Compare
dhhyi
force-pushed
the
refactor/variable-for-platform-id
branch
from
July 12, 2022 14:21
18a00ce
to
6b9929d
Compare
shauke
approved these changes
Jul 19, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
community
Community contributions
refactoring
Refactoring of current code
vote
Open for community input (pro/contra)
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.
PR Type
[x] Feature
[x] Refactoring (no functional changes, no API changes)
What Is the Current Behavior?
For checking if the current Angular app is running in SSR or Browser, the
PLATFORM_ID
has to be injected and the methodsisPlatformBrowser
andisPlatformServer
have to be used to perform the check. This always requires DI context and is rather verbose.What Is the New Behavior?
SSR
that can be used for this check.onSSREnvironment
to jestdescribe
so the SSR variable can be set for testing (default is false)Does this PR Introduce a Breaking Change?
[ ] Yes
[x] No
Other Information
As the
SSR
value is now injected into the build process with the webpack DefinePlugin, the values can be used for code minification. When using the usual way withPLATFORM_ID
, the chack can only be performed at runtime and all code is ending up in server and client bundles.Verify this by adding the following code:
Check where it turns up with (bash):
AB#75426