club-1 / flarum-ext-cross-references

Add cross reference links when a discussion is mentioned from another one.
GNU Affero General Public License v3.0
6 stars 1 forks source link

Multiple duplicated onclick events attached to links #39

Closed rob006 closed 1 year ago

rob006 commented 1 year ago

Note that #31 contains one minor fix that prevents attaching multiple onclick events to links: 2d0642b. It's not very elegant solution, but without it "back" button in browser did not worked correctly.

I can't seem to be able to replicate this issue. I didn't find instances of duplicated events and I didn't notice issues with the "back" button of the browser. Could please you open an issue with a reproducer?

Originally posted by @n-peugnet in https://github.com/club-1/flarum-ext-cross-references/issues/36#issuecomment-1436113748

I always have at least 2 events attached to links generated by this extension.

e613f66d

And new events are attached every time when I click on new post composer.

0feeade4

Probably this.$('.Post-body a') is not a correct way to scope links for specific post. Maybe something like $(this).find('.Post-body a') will work?

n-peugnet commented 1 year ago

It seems the onupdate() function is called a lot more often than what I thought. I think I will go for your fix for now.

n-peugnet commented 1 year ago

Let me know if you would like me to release a v1.0.4 version just for this fix.

rob006 commented 1 year ago

It is not super urgent, I think it can wait for next release.

n-peugnet commented 1 year ago

In the meantime, you could still use the dev-main composer version. I compiled the assets in production mode in this eventuality.

n-peugnet commented 1 year ago

Well, I won't have much time to work on this extension for some days so I will just release a version with this fix now