Hi Aditya,Sorry for the delay!I think we had been assuming that Back navigations in SPA, although tedious, didn't leave much room for performance opportunities.But that was more of a hunch than backed by data. And, recently, I heard similar feedback from other SPA partners who didn't think that the performance of their back navigations was great/on-par with a native BFCache.
You mentioned that client side navigations still require a lot of javascript processing: could you share some numbers or annotated devtools traces ? (feel free to PM me if preferable)In parallel to performance aspects, it also seems that an API would help the UA understand what's going on, and allow it to manage memory usage (e.g. evict the oldest / less useful SPA "pages").I'm also assuming that having to manage memory for the SPA nav stack is also an unnecessary burden. Would that also be an interesting avenue as well?On Fri, May 21, 2021 at 5:23 PM Aditya Punjani <aditya....@airbnb.com> wrote:Hey folks,This is just a thought experiment but I was wondering what it would take to make some version of bfcache work for client side apps. Today bfcache works great for document navigations but is not useful in SPA client side navigations.One of the most common use cases on the web is navigating back and forth between a search results page and various item pages from the search results.If we had an API like bfcache.pushState() and bfcache.popState() that could serialize the dom state of the search results page, then we client side navigate to an item page and on back instead of doing a client side navigation we just restore the serialized page from the bfcache.This would significantly improve performance in client side apps where client side navigations still require a lot of javascript processing.Curious if anything along these lines would be feasible?Thanks,Aditya--Kenji BAHEUXProduct Manager - ChromeGoogle Japan
--
You received this message because you are subscribed to the Google Groups "bfcache-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bfcache-dev...@chromium.org.
To view this discussion on the web, visit https://groups.google.com/a/chromium.org/d/msgid/bfcache-dev/CADWWn7UB8wEfa%2BXRkyXx4jY5KuGZiDsduigmzF1iKkjzPrhhMQ%40mail.gmail.com.
I agree with Fergal that it seems like we have enough primitives to solve the performance aspect of SPA navs, although perhaps not ergonomically. I wonder if there's something here we can do to help, like automatically doing the content-visibility thing to preserve rendering state somehowAs for the usability part, and what to record, it seems like in general we'd want to persist not just the DOM but also scroll positions and perhaps some script state as well? For MPA BFCache this is "easy" enough since we just cache the whole document. For SPA, however, the document itself is still used, so we need to store some snapshot of state. It's unclear to me whether we can use BFCache for this, or what it would mean for some state to be restored and some to remain live.