mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
Fixed hash change for links
no issue - Hash handler was not updating Portal state if it pointed to a Portal link, which caused the need for a full refresh to reflect new link triggers - Updates hash handler to use handle both preview and link states
This commit is contained in:
parent
bcf2b5872b
commit
74a7232d0c
@ -109,7 +109,7 @@ export default class App extends React.Component {
|
||||
|
||||
// Listen to preview mode changes
|
||||
this.hashHandler = () => {
|
||||
this.updateStateForPreview();
|
||||
this.updateStateForPreviewLinks();
|
||||
};
|
||||
window.addEventListener('hashchange', this.hashHandler, false);
|
||||
} catch (e) {
|
||||
@ -295,13 +295,16 @@ export default class App extends React.Component {
|
||||
}
|
||||
|
||||
/**Handle state update for preview url changes */
|
||||
updateStateForPreview() {
|
||||
updateStateForPreviewLinks() {
|
||||
const {site: previewSite, ...restPreviewData} = this.fetchPreviewData();
|
||||
const {site: linkSite, ...restLinkData} = this.fetchLinkData();
|
||||
this.setState({
|
||||
site: {
|
||||
...this.state.site,
|
||||
...(linkSite || {}),
|
||||
...(previewSite || {})
|
||||
},
|
||||
...restLinkData,
|
||||
...restPreviewData
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user