Skip to content

Refactor hash methods to accept callbacks#12188

Merged
tyrasd merged 2 commits into
openstreetmap:developfrom
hlfan:hash-update
Apr 30, 2026
Merged

Refactor hash methods to accept callbacks#12188
tyrasd merged 2 commits into
openstreetmap:developfrom
hlfan:hash-update

Conversation

@hlfan
Copy link
Copy Markdown
Contributor

@hlfan hlfan commented Apr 9, 2026

window.history.replaceState is called in many places with an identical need for object <-> querystring conversion.

A new exposed update method can remove quite a bit of duplicate code.

Collecting these actions also increases modularity for things like dispatching events (openstreetmap/openstreetmap-website#6811).

@tyrasd tyrasd added the chore Improvements to the iD development experience or codebase label Apr 10, 2026
Comment thread modules/behavior/hash.js Outdated
Comment thread modules/behavior/hash.js Outdated
@hlfan
Copy link
Copy Markdown
Contributor Author

hlfan commented Apr 15, 2026

I've moved updateTitle out of the exposed function to be able to call behaviorHash.patch({ photo: null }); without requiring the context.

@tyrasd
Copy link
Copy Markdown
Member

tyrasd commented Apr 21, 2026

@hlfan it seems like you're continuing to find to improvements for this functionality. 👍 let me know once you're happy for this to be reviewed/merged.

@hlfan
Copy link
Copy Markdown
Contributor Author

hlfan commented Apr 21, 2026

I'm happy about a review anytime @tyrasd!

I think it is now where I wanted to get it to in terms of modularity after noticing the singleton behaviour bug.
Just needed to work around my apparent chore brain quota. 😉

@hlfan hlfan requested a review from tyrasd April 24, 2026 18:39
@tyrasd tyrasd merged commit 6143e6d into openstreetmap:develop Apr 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Improvements to the iD development experience or codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants