Skip to content

Conversation

@rallisf1
Copy link
Contributor

Some SPAs (e.g. Zammad), use hash routing (e.g. /#ticket/...). With this change you can have working internal routing for links like https://my.nextcloud.com/apps/external/1/#ticket/zoom/102

Some SPAs (e.g. Zammad), use hash routing (e.g. /#ticket/...). With this change you can have working internal routing for links like `https://my.nextcloud.com/apps/external/1/#ticket/zoom/102`

Signed-off-by: John Rallis <rallisf1@yahoo.gr>
@provokateurin provokateurin self-requested a review March 21, 2025 11:12
Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting idea!
I think this needs to be extended to also automatically update the hash if the user changes it in the URL bar.
For that you need to listen to developer.mozilla.org/en-US/docs/Web/API/Window/hashchange_event and update the iframe src accordingly.

Also you can not just append the hash, because the existing iframe src might already have a hash.

Let me know if you need any help with this!

listen for hashchange
properly update hash value

Signed-off-by: John Rallis <rallisf1@yahoo.gr>
@rallisf1
Copy link
Contributor Author

I updated as you requested.

Ideally we should catch the hashchange in the iframe as well, but that requires using postMessage, which needs custom code in the SPA. As this is mostly unavailable (e.g. when loading a SaaS, or just not able to edit the SPA's code), I didn't add an event listener for it.

@provokateurin
Copy link
Member

Indeed, that probably won't work.

@provokateurin
Copy link
Member

I'll test it tomorrow, but the code looks good :) Thank you for your contribution!

Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected 🚀

@provokateurin provokateurin enabled auto-merge March 25, 2025 11:31
@provokateurin provokateurin disabled auto-merge March 25, 2025 11:34
@provokateurin provokateurin merged commit de0b807 into nextcloud:master Mar 25, 2025
30 of 31 checks passed
@github-actions
Copy link

github-actions bot commented Apr 5, 2025

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants