Skip to content
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

Add missing property redirected to VisitResponse #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

olivaresf
Copy link
Member

Turbo-iOS PR: hotwired/turbo-ios#225

When a redirection with a responseHTML would happen (e.g. a form submission), Turbo Native receives something like the following:

← visitProposed [
    "location": http://localhost:45678/submit_redirected, 
    "timestamp": 1725557992593, 
    "options": {
        action = replace;
        response =     {
            redirected = 1;
            responseHTML = "{HTML with flash notice}";
            statusCode = 200;
        };
        shouldCacheSnapshot = 0;
    }
]

This usually gets turned into a JavaScript visit and then handed over to the bridge, which begins the visit by calling visitLocationWithOptionsAndRestorationIdentifier.

However, when transforming this proposal JS -> Swift (for processing) and back to JS (for bridge consumption), visitProposed["options"]["response"]["redirected"] was being lost. This caused responseHTML to be ignored and a replace visit to be proposed instead.

By adding redirected to VisitResponse the behavior is now correct.

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

Successfully merging this pull request may close these issues.

1 participant