-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Handle hash based frontend routing #3574
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer a query param _action=foo
rather than redirect_path
so that we can decouple the actions from the actual client-side URLs.
We only need to synchronize the list of literal action names then and our backend and frontend become more agnostic of each other.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3574 +/- ##
==========================================
- Coverage 95.97% 95.96% -0.01%
==========================================
Files 680 681 +1
Lines 21893 21892 -1
Branches 2531 2533 +2
==========================================
- Hits 21011 21009 -2
Misses 611 611
- Partials 271 272 +1 ☔ View full report in Codecov by Sentry. |
One thought that I had: The number of I took a look at the possible redirects from the backend and it seems to be all covered. There're still some old URL formats in tests but I think they mimic what is emitted by the SDK (e.g. in authentication with the |
db24f88
to
6eb625e
Compare
c6ead31
to
64a6914
Compare
.add( | ||
{ | ||
"_action": "afspraak-annuleren", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so right now with hash based routing, this would result in a URL like example.com/myform?time=...&submission_uuid=...#/afspraak-annuleren
while it should be:
example.com/myform#/afspraak-annuleren?time=...&submission_uuid=...
- i.e. the time & submission_uuid really should be _action_params
as they're directly related to the action.
There are still some failing tests, mainly because: open-forms/src/openforms/frontend.py Lines 23 to 27 in feb37d3
This performs a first round of URL encoding, e.g. Then furl does a second round of URL encoding, resulting in
Another option would be to have Edit: in fact this might be fine |
|
||
def test_frontend_redirect_hash(self): | ||
submission = SubmissionFactory.create( | ||
form_url="https://example.com/basepath#after_hash", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to have it (and keep it!), but let's also do the data migration where we clean/sanitize the URLs for existing submissions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the migration, not sure if it covers all cases? Let me know if you think some other cases should be taken into account into this migration
f2ecfc6
to
031e3f1
Compare
Fixes #3362
Linked to open-formulieren/open-forms-sdk#586
This adds a new query parameter
redirect_path
, that the frontend sdk should special case onwindow.onload
to redirect to the correct path based on the configured routing method.