Skip to content
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

@angular/ssr - how to handle responsiveness #26459

Closed
zygarios opened this issue Nov 21, 2023 · 4 comments
Closed

@angular/ssr - how to handle responsiveness #26459

zygarios opened this issue Nov 21, 2023 · 4 comments

Comments

@zygarios
Copy link

zygarios commented Nov 21, 2023

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

Yes

Description

With the new version of Angular and its migration to @angular/ssr, using 'ng serve' is not based on an Express server. How can I locally work on a project, including hydration, when some components are displayed only for mobile devices and others only for desktop? Previously, I could do this by passing the user-agent to the ngx-device-detector library and obtaining information about the user's device. Unfortunately, currently on localhost I do not have the ability to check what device it is because the REQUEST and RESPONSE have a value of null. As a result, it is difficult to work on the project. How can I deal with this?

`


@if (!isMobile) {

}
@if (isMobile) {

}

`

Currently, on the server side, the isMobile variable will always assume a hardcoded value, e.g. true, until it receives the correct value on the browser side. This causes incompatibility, e.g. in hydration, because the DOM layout on the browser will be different from the server.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.0.0

Anything else?

No response

@alan-agius4 alan-agius4 transferred this issue from angular/angular Nov 22, 2023
@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2023
@zygarios
Copy link
Author

Ok, but i dont know any other solution to handle it on server...

@ghost
Copy link

ghost commented Nov 22, 2023

🥰🥰

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
2 participants