AlexsLemonade / refinebio-frontend

Frontend app for refine.bio
https://www.refine.bio
Other
7 stars 7 forks source link

Improve mobile device detection on the server side #875

Open arielsvn opened 4 years ago

arielsvn commented 4 years ago

We use the component ResponsiveSwitch to detect when a user is navigating on a small device and render the mobile version of the app. This component measures the width of the screen on componentDidMount.

On the serverside, NextJS never mounts the components so it assumes that the user is on a large device. However, we could make a better guess based on the user agent.

This should improve our page score on mobile and reduce the time to the first meaningful paint.

image