Coder Social home page Coder Social logo

Transition API about history HOT 3 CLOSED

ryanflorence avatar ryanflorence commented on April 26, 2024
Transition API

from history.

Comments (3)

mjackson avatar mjackson commented on April 26, 2024

Currently history only handles case (1)

We actually support both (1) and (2) with the current API.

The getUserConfirmation API was prompted by the fact that, on most platforms, there's usually one standard way to prompt a user for confirmation:

On all of these platforms, we can provide a sane default and the vast majority of users never actually have to know about getUserConfirmation. All they have to know is "I need to return a string from one of my transition hooks if I don't want the transition to take place". We could easily support return false as well. Users don't need to know anything about callbacks or other args in their transition hooks.

Advanced users can still display their own custom dialog inside getUserConfirmation. The only case where this API is a little tricky is when they need to show different custom confirmation dialogs based on context. This requires a bit more work because they need to keep track of where they currently are in the app and show the corresponding dialog.

My questions are:

  1. Is it worth making the simple top-level API more complex for the needs of (what I believe is) a small percentage of users? We're talking about a subset (those who want to display different dialogs based on context) of a subset (those who want to use custom dialogs) of our users.
  2. Should we be encouraging users to show different confirmation dialogs based on context? Feels like a poor design decision, and one that most apps don't actually make.

from history.

ryanflorence avatar ryanflorence commented on April 26, 2024

Is it worth making the simple top-level API more complex

Probably not.

Lets wait for people to complain.

from history.

fkrauthan avatar fkrauthan commented on April 26, 2024

Well there are a bunch of good examples where you want custom dialog's. Think about a react application that has a sign up and a chat (e.g. Slack). Now on signup you might wanna warn the user that he looses all his data if he leaves. On the chat you want him to make a decision between do you wanna throw your message away or send it before leaving or cancel leaving at all. For that you need to have the capabilities to show context based custom dialog's. And I am sure there are tons of other use-cases too where you need that.

from history.

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.