remix-run / history

Manage session history with JavaScript
MIT License
8.29k stars 960 forks source link

v5 hash history not longer emits hashchange event #910

Open markdoten opened 2 years ago

markdoten commented 2 years ago

Listening on the window for the hashchange no longer works in V5 though it worked in V4.

I'm using Chrome v96.

Reproduce:

import { createHashHistory } from "history";
const history = createHashHistory();
window.addEventListener('hashchange', () => console.log('HASH CHANGED'));
history.push("/test");

Nothing is printed to the console.

Can be seen here: https://codesandbox.io/s/fervent-keldysh-n9g56?file=/src/index.js

cx91 commented 1 year ago

Listening on the window for the hashchange no longer works in V5 though it worked in V4.

I'm using Chrome v96.

Reproduce:

import { createHashHistory } from "history";
const history = createHashHistory();
window.addEventListener('hashchange', () => console.log('HASH CHANGED'));
history.push("/test");

Nothing is printed to the console.

Can be seen here: https://codesandbox.io/s/fervent-keldysh-n9g56?file=/src/index.js

Hello, have you found a solution?