Skip to content

Remove jQuery throttle-debounce dependency#6811

Draft
hlfan wants to merge 1 commit intoopenstreetmap:masterfrom
hlfan:id-no-throttle
Draft

Remove jQuery throttle-debounce dependency#6811
hlfan wants to merge 1 commit intoopenstreetmap:masterfrom
hlfan:id-no-throttle

Conversation

@hlfan
Copy link
Copy Markdown
Collaborator

@hlfan hlfan commented Feb 13, 2026

iD already throttles its hash updates. Hooking into this allows dropping the vendored dependency, leaving only leaflet-related ones.

Comment thread app/assets/javascripts/id.js Outdated
@HolgerJeromin
Copy link
Copy Markdown
Collaborator

Can we have instead a (throttled) event from iD on its parent like?

window.parent?.postMessage('id-hash-update', '*' /* This is no sensitive data, so ok to allow all targets */);

@HolgerJeromin

This comment was marked as resolved.

@hlfan hlfan marked this pull request as ready for review February 17, 2026 15:38
@tomhughes

This comment was marked as resolved.

@hlfan

This comment was marked as resolved.

@HolgerJeromin
Copy link
Copy Markdown
Collaborator

My favorite solution would be here in this repo in one file window.addEventListener("message", ... and in the id repo window.parent?.postMessage('id-hash-update', '*');

@hlfan
Copy link
Copy Markdown
Collaborator Author

hlfan commented Feb 18, 2026

Yeah that would be nice, or exposing iD's lodash utilities similarly to d3.

@tyrasd which option do you think would be more in-scope for the iD repo?

@hlfan

This comment was marked as resolved.

Comment thread app/assets/javascripts/id.js Outdated
@hlfan
Copy link
Copy Markdown
Collaborator Author

hlfan commented Apr 8, 2026

Yeah that would be nice, or exposing iD's lodash utilities similarly to d3.

which option do you think would be more in-scope for the iD repo?

Or @k-yle, maybe you have an idea?

@k-yle
Copy link
Copy Markdown
Contributor

k-yle commented Apr 9, 2026

Or @k-yle, maybe you have an idea?

I would suggest adding a new event to iD's coreContext, and emitting that event whenever we call history.replaceState()1.

Then you don't need to override history.replaceState in this repo, and you can remove jQuery.throttle since iD already thottles history.replaceState by 500ms.

Footnotes

  1. which is unfortunately copy-pasted many times in iD, that should probably be cleaning up at some point 🤷

@hlfan hlfan marked this pull request as draft April 9, 2026 09:52
@HolgerJeromin
Copy link
Copy Markdown
Collaborator

I would suggest adding a new event to iD's coreContext, and emitting that event whenever we call history.replaceState()

I have no intern view what this event is, but custom events are not always walk through the iframe barrier, while postMessage do.

@hlfan
Copy link
Copy Markdown
Collaborator Author

hlfan commented Apr 9, 2026

We are currently using parent. for that anyway.

@hlfan
Copy link
Copy Markdown
Collaborator Author

hlfan commented Apr 30, 2026

Does the second change actually make anything simpler? It certainly increases the amount of code...

I'll revisit this change in a separate pr to sandbox the iD frame as per the security report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants