use right update functions

This commit is contained in:
Florian Dold 2016-10-10 02:36:12 +02:00
parent db0fc77698
commit 352f059eb2

View File

@ -43,7 +43,6 @@ function onUpdateNotification(f: () => void) {
class Router extends preact.Component<any,any> { class Router extends preact.Component<any,any> {
static setRoute(s: string): void { static setRoute(s: string): void {
window.location.hash = s; window.location.hash = s;
preact.rerender();
} }
static getRoute(): string { static getRoute(): string {
@ -64,7 +63,7 @@ class Router extends preact.Component<any,any> {
componentWillMount() { componentWillMount() {
console.log("router mounted"); console.log("router mounted");
window.onhashchange = () => { window.onhashchange = () => {
this.forceUpdate(); this.setState({});
for (let f of Router.routeHandlers) { for (let f of Router.routeHandlers) {
f(); f();
} }