Facebook.comffacebook. Rebuilding our tech stack for a new autoratingtool.esrb.org

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

This allows us to use a new feature of to express which rendering code is needed, depending on what type of data is returned. Even better, the PhotoComponent itself describes exactly which data on the photo attachment type it needs as a fragment, which means we can even split out the query logic. To reduce the number of network round trips required when loading a new page, the client needs to know which resources will be needed for each route ahead of time. Features like dark mode and saving your place in News Feed had no straightforward technical implementation. The page after Tier 1 code loads and renders. The page after Tier 2 code loads and renders.

Nächster

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

Often this is done using or a similar primitive. We call this a route map and each entry a route definition. Manually converting to rems adds engineering overhead and the potential for bugs, so we have our build tool do this conversion for us. With , this is even easier, as we can explicitly craft our loading states to ensure a smooth, top-down page load experience. Splitting our code this way enables us to improve time to first paint and time to visual completion by reducing the amount of code that needs to be downloaded to hit each milestone. The simplest way to do this is to download both versions for all people, but this means we often download code that is never executed. If the post has a special attachment, such as a photo, we describe that we need the PhotoComponent in order to render that photo.

Nächster

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

We set budgets based on performance goals, technical constraints, and product considerations. As the page is loading, the server is able to check the experiment and send down only the required version of the code. Now, we colocate our styles with our components so they can be deleted in tandem, and only split them into separate bundles at build time. These concepts and patterns can be applied to any client-side app using any framework or library. This is much less jarring, and it mimics standard browser behavior. Engineering experience improvements and user experience improvements must go hand in hand, and performance and accessibility cannot be viewed as a tax on shipping features. With Relay, we know statically what data the page needs.

Nächster

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

Most significantly, the loading screen is able to render much earlier. This means that as soon as our server receives the request for a page, it can immediately start preparing the necessary data and download it in parallel with the required code. Instead, we dynamically add route definitions to the route map during the session, as new links are rendered. We allocated page-level budgets and subdivide the page based on product boundaries and team boundaries. But starting from the ground up with a client-first app brought a new set of problems. Shared infra is added to a carefully curated list and given its own budget. On the other hand, the more stories we fetch in one query, the slower that query gets, which leads to longer query times and a longer Visually Complete time for even the first story.

Nächster

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

We needed to rebuild the site quickly while also addressing speed and other user experience issues — and we needed to do it in such a way that it would be sustainable for years to come. We needed to take a step back to rethink our architecture. These dependencies are decided at runtime, based on which data is returned from the back end. Tier 2 needs to be fully interactive. When navigating to a new route, we need to fetch various code and data from the server to render the destination page.

Nächster

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

It was previously possible for changes in one file to break the styles in another without the author realizing it. Each of these new features and technologies incrementally slowed the site down and made it harder to maintain. However, we believed we could build a client-driven app with a competitively fast startup time. We should deliver only the resources we need, and we should strive to have them arrive right before we need them. The route map and the router live at the very top of the application, allowing the combination of current application and router state to drive app-level state decisions, such as the behavior of the top navigation bar or chat tabs based on the current route.

Nächster

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

We knew that if we wanted a client-side React app for Facebook. To check out the redesign, visit from your desktop. Since this can make page navigation slow, we instead start our first request for some of the necessary resources even before a link is clicked: We kick off fetches early, preloading on hover or focus, and fetching on mousedown. AdditionalData defer } Route maps and definitions for faster navigation Fast navigation is an important feature of single-page applications. We stream this data with the page as it becomes available so the client can avoid additional round trips and render the final page content sooner.

Nächster

Rebuilding our tech stack for a new autoratingtool.esrb.org

facebook.comffacebook

The app uses these EntryPoints to automatically decide when to fetch the resources, making sure the right thing happens by default. Streaming data for fewer round trips and better interactivity On the initial load of Facebook. However, if we do this naively i. A slightly better approach is to use dynamic imports on render, but this can be slow. By standardizing our tech stack, we have been able to rethink how we introduce functionality that people want in a performant, sustainable way — even as we operate at engineering and product scale. This example is specific to desktop, but other heuristics can be used for touch devices.

Nächster