Skip to content

Commit

Permalink
fix go back homepage and refresh favorites (#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Barbieri authored Nov 12, 2019
1 parent 14e0c18 commit ce55f97
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,10 +853,11 @@ export class BrowserTab extends PureComponent {
const homepageScripts = `
window.__mmFavorites = ${JSON.stringify(this.props.bookmarks)};
window.__mmSearchEngine="${this.props.searchEngine}";
window.postMessage('updateFavorites', '*');
`;
this.setState({ homepageScripts }, () => {
const { current } = this.webview;
if (this.isHomepage() && current) {
if (current) {
current.injectJavaScript(homepageScripts);
}
});
Expand Down Expand Up @@ -1083,8 +1084,6 @@ export class BrowserTab extends PureComponent {
Analytics.trackEvent(ANALYTICS_EVENT_OPTS.DAPP_HOME);
setTimeout(() => {
this.lastUrlBeforeHome = lastUrlBeforeHome;
// update bookmarks on homepage
this.refreshHomeScripts();
}, 1000);
};

Expand Down Expand Up @@ -1293,6 +1292,9 @@ export class BrowserTab extends PureComponent {
};

onPageChange = ({ url }) => {
if (this.isHomepage(url)) {
this.refreshHomeScripts();
}
if (url === this.state.url) return;
const { ipfsGateway } = this.props;
const data = {};
Expand Down

0 comments on commit ce55f97

Please sign in to comment.