Closed Bug 1614502 Opened 5 years ago Closed 5 years ago

Add a mechanism for producing a static version of about:home periodically that can be cached for startup.

Categories

(Firefox :: New Tab Page, task, P2)

task

Tracking

()

RESOLVED FIXED
Firefox 77
Tracking Status
firefox77 --- fixed

People

(Reporter: mconley, Assigned: mconley, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

react-dom-server allows one to take some React components and a state, and generate static mark-up that can be rendered by the browser. The React client libraries then know how to attach to these static mark-up, and "hydrate" it with more up-to-date state as it comes down.

A major component of bug 1614351 is to try to take the dynamically computed about:home, and render it to a string that can be flushed to the disk to be read on start-up. react-dom-server seems well suited to this, despite the fact that it was designed to run in server environments.

So a few things that we'd need to do here:

  1. Is it possible to run react-dom-server in the browser environment? Even better, can it run in a Worker?
  2. Are there any license restrictions or security concerns that would prevent us from bringing react-dom-server into the tree and relying on it?

I believe the Activity Stream attempted to do this a few years ago, so I'm interested in hearing about the challenges they ran into during the first attempt.

Marking as P2 to get it prioritized. Let us know if you'd like to P it differently depending on how you're organizing this work. Thanks!

:mconley - do you mind if we assign this bug to you so that it cleans up our triage/bug process for New Tab component?

Flags: needinfo?(mconley)
Priority: -- → P2

Yeah, I'll take this.

Assignee: nobody → mconley
Flags: needinfo?(mconley)

It turns out that we already have react-dom-server in tree:

https://searchfox.org/mozilla-central/rev/2fd8ffcf087bc59a8e5c962965bbb7bf230bcd28/devtools/client/shared/vendor/react-dom-server.js

unfortunately, I don't think we can repurpose the current DevTools one, and we'll need to vendor in a distinct copy for about:home. See bug 1618001 about how we can have a single copy of the React libraries across the tree.

In the meantime, I'm going to re-purpose this bug. We know we can have react-dom-server in the tree. This bug will now be about landing it in-tree, and using it to construct a static document that can be cached using the mechanism introduced in bug 1621032.

Depends on: 1621032
Summary: Investigate the practicality of bringing react-dom-server into the tree → Add a mechanism for producing a static version of about:home periodically that can be cached for startup.
Attachment #9135522 - Attachment description: Bug 1614502 - Expose functions or rendering Activity Stream → Bug 1614502 - [WIP] Expose functions or rendering Activity Stream
Attachment #9135522 - Attachment description: Bug 1614502 - [WIP] Expose functions or rendering Activity Stream → Bug 1614502 - Expose utility functions for rendering Activity Stream. r?Mardak
Attachment #9135523 - Attachment description: Bug 1614502 - [WIP] Experimental cache writer → Bug 1614502 - Add a mechanism that can generate an about:home document for a startup cache. r?Gijs,k88hudson
Attachment #9135522 - Attachment description: Bug 1614502 - Expose utility functions for rendering Activity Stream. r?Mardak → Bug 1614502 - Expose utility functions for rendering Activity Stream. r?Mardak!
Attachment #9135523 - Attachment description: Bug 1614502 - Add a mechanism that can generate an about:home document for a startup cache. r?Gijs,k88hudson → Bug 1614502 - Add a mechanism that can generate an about:home document for a startup cache. r?Gijs!,k88hudson!
Attachment #9135521 - Attachment description: Bug 1614502 - Vendor react-dom-server 16.8.6 into the newtab component. r?k88hudson! → Bug 1614502 - Vendor react-dom-server into the newtab component. r?k88hudson!
Flags: needinfo?(khudson)
Flags: needinfo?(sdowne)
Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8bf3fe111c40 Vendor react-dom-server into the newtab component. r=k88hudson https://hg.mozilla.org/integration/autoland/rev/7ec776d31a2c Expose utility functions for rendering Activity Stream. r=Mardak https://hg.mozilla.org/integration/autoland/rev/626dd2a045af Add a mechanism that can generate an about:home document for a startup cache. r=Gijs,k88hudson
Regressions: 1631611

I provided the need-info directly to mconley in slack iirc.

Flags: needinfo?(sdowne)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: