Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix browser intial load #1623

Merged
merged 3 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,7 @@ exports[`Browser should render correctly 1`] = `
"zIndex": 1,
}
}
>
<WebView
allowsInlineMediaPlayback={true}
cacheEnabled={true}
injectedJavaScript={null}
javaScriptEnabled={true}
javascriptEnabled={true}
onError={[Function]}
onLoadEnd={[Function]}
onLoadProgress={[Function]}
onLoadStart={[Function]}
onMessage={[Function]}
onNavigationStateChange={[Function]}
onShouldStartLoadWithRequest={[Function]}
originWhitelist={
Array [
"http://*",
"https://*",
]
}
renderError={[Function]}
sendCookies={true}
source={
Object {
"uri": null,
}
}
style={
Object {
"flex": 1,
"zIndex": 1,
}
}
testID="browser-webview"
useSharedProcessPool={true}
useWebkit={true}
userAgent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/76.0.3809.123 Mobile/15E148 Safari/605.1"
/>
</View>
/>
<View
style={
Object {
Expand Down
11 changes: 2 additions & 9 deletions app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1125,21 +1125,14 @@ export class BrowserTab extends PureComponent {
current && current.reload();
};

forceReload = initialReload => {
forceReload = () => {
this.isReloading = true;

this.toggleOptionsIfNeeded();
// As we're reloading to other url we should remove this callback
this.approvalRequest = undefined;
const url2Reload = this.state.inputValue;

// If it is the first time the component is being mounted, there should be no cache problem and no need for remounting the component
if (initialReload) {
this.isReloading = false;
this.go(url2Reload);
return;
}

// Force unmount the webview to avoid caching problems
this.setState({ forceReload: true }, () => {
// Make sure we're not calling last mounted webview during this time threshold
Expand All @@ -1157,7 +1150,7 @@ export class BrowserTab extends PureComponent {
if (this.webview && this.webview.current) {
this.webview.current.stopLoading();
}
this.forceReload(true);
this.forceReload();
this.init();
};

Expand Down