Skip to content

Commit

Permalink
fix(core): 🐛 update title with "next"
Browse files Browse the repository at this point in the history
Closes #384
  • Loading branch information
thierrymichel committed Apr 23, 2019
1 parent a06ec61 commit f8c1940
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
11 changes: 0 additions & 11 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ export class Core {
wrapper: this._wrapper,
});

this._updateTitle(data);
this._resetData();
} catch (error) {
// Something went wrong (rejected promise, error, 404, 505, other…)
Expand Down Expand Up @@ -585,16 +584,6 @@ export class Core {

this.hooks.do('reset', this.data);
}

/**
* Update document title.
*/
private _updateTitle(data: ITransitionData): void {
const { html } = data.next;
const { title } = this.dom.toDocument(html);

document.title = title;
}
}

const core = new Core();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/***/

// Definitions
import { ISchemaAttribute, Scope, Wrapper } from '../defs';
import { ISchemaAttribute, ITransitionData, Scope, Wrapper } from '../defs';
// Schemas
import { schemaAttribute } from '../schemas/attribute';

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export const updateNext = async (
// next.html = dom.getHtml(nextDocument);
// next.html = nextDocument.innerHTML;
next.html = html;

const { title } = dom.toDocument(html);

document.title = title;
}
}
};
Expand Down

0 comments on commit f8c1940

Please sign in to comment.