redfin / react-server

:rocket: Blazing fast page load and seamless navigation.
https://react-server.io/
Apache License 2.0
3.89k stars 184 forks source link

Simplify device type routing #950

Closed gigabo closed 6 years ago

gigabo commented 6 years ago

The mobile-detect package is large. We shouldn't send it to the browser.

This change uses mobile-detect on the server only. It associates a device type with the request and sends only that pre-determined value to the browser.

This eliminates the "mobile" route target, which was previously the union of "phone" and "tablet". These two must be specified individually going forward (though they may route to the same page class). It also adds a "desktop" route target.

The getMobileDetect() method on the request context is eliminated, and replaced with a getDeviceType() method that returns a string.

This is a breaking change.

gigabo commented 6 years ago

This addresses #883.