GithubHelp home page GithubHelp logo

Comments (5)

zachwaugh avatar zachwaugh commented on July 26, 2024 1

Thanks for bringing this up. Turbo has a solution for this, but I don't think it's documented or shown in the demo. When Turbo submits a form that redirects, it will automatically follow that redirect as you noticed. It will then propose a visit to the app. That VisitProposal though will include the full response from the redirect in the proposal.options. You can pass that response to the next visit and it will use it instead of making another request. It also has the advantage of rendering immediately.

let options: VisitOptions = ... // options saved from previous visit proposal
session.visit(visitable, options: options)

I'll add an example of that to the demo project.

from turbo-ios.

ghiculescu avatar ghiculescu commented on July 26, 2024

Great, thanks @zachwaugh - I will give that a try once the demo's updated. I know it's probably not your domain, but do you know if the same approach will work for turbo-android?

from turbo-ios.

zachwaugh avatar zachwaugh commented on July 26, 2024

I believe Android works the same way, but @jayohms can confirm.

from turbo-ios.

ghiculescu avatar ghiculescu commented on July 26, 2024

Okay I tested that code snippet, and it seems to work well for this particular issue.

Is there ever a reason to call session.visit without the options argument? The only case I can think of is on initial boot, at which point options would be nil anyway.

from turbo-ios.

zachwaugh avatar zachwaugh commented on July 26, 2024

Mostly just for convenience. If you omit options, it uses the default options, which is just an advance action and no response - https://github.com/hotwired/turbo-ios/blob/main/Source/Session/Session.swift#L64.

from turbo-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.