balupton/history.js — pull request #115 by andrew-sayers--slando (2011-10-18 12:22:41+00:00)
Title: Don't reuse IDs in getIdByState()

Reusing old states in getIdByState() causes History.js to behave differently to the raw History API. This patch removes checking altogether - please let me know if you would be happier with something that e.g. had an option or did something cleverer.

The raw History API lets you repeatedly pushState() with similar states, and pushes a new state each time. History.js will assign the current ID when you try to push a new (similar) state, and will then ignore the push because of the isLastSavedState() check. In our case, we want to push similar states to let users resubmit searches to our site (we use browser caching to handle "too frequent" searching).

This patch removes the check when generating a new ID. This should guarantee each search gets its own ID without harming the checks for actual duplicate calls.