Skip to content

Fix turbo redirect #11688

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

Merged
merged 4 commits into from
Nov 26, 2024
Merged

Fix turbo redirect #11688

merged 4 commits into from
Nov 26, 2024

Conversation

nanaya
Copy link
Collaborator

@nanaya nanaya commented Nov 25, 2024

The previous fix doesn't quite work as turbo just ends up doing a browser native visit and breaks on form action due to 200 status.

The previous fix doesn't quite work as turbo just ends up doing a
browser native visit and breaks on form action due to 200 status.
@nanaya nanaya force-pushed the turbo-redirect-pt2 branch from 0827c35 to e3a1426 Compare November 25, 2024 12:11
@@ -24,6 +24,24 @@ document.addEventListener('turbo:submit-end', (e) => {
}
});

document.addEventListener('turbo:before-fetch-response', (e) => {
if (!e.detail.fetchResponse.contentType.match(/^text\/osu-turbo-redirect[ ;]*/)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

contentType is null when replacing an existing user-cover-preset or toggling enabled/disabled (and maybe similar buttons?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well those only need to reload the page, not redirect

@notbakaneko notbakaneko merged commit 3ada007 into ppy:master Nov 26, 2024
3 checks passed
@nanaya nanaya deleted the turbo-redirect-pt2 branch December 17, 2024 13:08
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