Don't remove view from onscreen window when reloading

I'm observing that when a BrowserView is removed from the main window
and added to the offscreenView, it loses visibility state and RAFs no
longer execute. This prevents the subsequent video load from succeeding
on some sites like Twitch. As a workaround, we'll no longer offscreen the
view when reloading. This means the view may linger onscreen for a
moment, and potentially if there are issues loading there might be
glitches onscreen. I'd like to find a better solution for moving the
view offscreen in the future and keeping it rendering.

If this causes disruptive glitches, we could either:

- Remove and recreate the view on reload (wasteful, ensures clean
starts)

- Size the view down to 1x1 pixels so it is barely visible (could this
interfere with responsive designs?)
This commit is contained in:
Max Goodhart
2020-11-12 01:05:05 -08:00
parent a25d2211cd
commit e10507780e

View File

@@ -23,10 +23,13 @@ const viewStateMachine = Machine(
displaying: {
id: 'displaying',
initial: 'loading',
entry: assign({
pos: (context, event) => event.pos,
content: (context, event) => event.content,
}),
entry: [
assign({
pos: (context, event) => event.pos,
content: (context, event) => event.content,
}),
'offscreenView',
],
on: {
DISPLAY: {
actions: assign({
@@ -57,7 +60,6 @@ const viewStateMachine = Machine(
states: {
loading: {
initial: 'navigate',
entry: 'offscreenView',
states: {
navigate: {
invoke: {