metafizzy / flickity-hash

Select Flickity slides with links
11 stars 10 forks source link

Page browser history state is overwritten with `null` when using the hash option #7

Closed bendesilva closed 2 years ago

bendesilva commented 4 years ago

If page uses the History API and stores data within the state object, it is lost when using the Flickity hash package as it provides null as the first option in the history.replaceState method, potentially breaking functionality which relies on data in the state object.

The history.replaceState call should read the current browser state using history.state, which returns the current object, or null if not yet modified through history methods.

desandro commented 2 years ago

Ah, thank you for this contribution! Great PR! email yo@metafizzy.co for some goodies