GithubHelp home page GithubHelp logo

Comments (7)

thysultan avatar thysultan commented on June 9, 2024 1

Yes, there's a delay, maybe we can make it 100ms(as a default) and allow the delay prop that you suggest. Right now i think the default is 600ms.

from dyo.

thysultan avatar thysultan commented on June 9, 2024

Isn't that from getRandomNumberDelayed that returns a promise with a 3s delay(3000ms)?

from dyo.

thysultan avatar thysultan commented on June 9, 2024

NVM, i see what you mean(the showing of the loading state).

from dyo.

Zolmeister avatar Zolmeister commented on June 9, 2024

Indeed, it's 600ms

Utility.timeout(callback, Enum.network)

export var network = timeout * 6

I'm not sure it should have a default timeout. I set one for server-side rendering at the top of the render loop, but otherwise timeout should be handled by the suspense promise itself.

from dyo.

thysultan avatar thysultan commented on June 9, 2024

The 'default timeout' does not affect server-side rendering as you cannot interact with the ui in server-side rendering. the default timeout only takes effect for subsequent events after the initial rendering(i.e in this case the click event) — in this example the "Loading..." timeout doesn't happen for the initial load.

The idea behind the timeout was to avoid a loading state if the network response time is fast enough as to not be perceptible, but 600ms seemed to be too much thus my suggestion for 100ms.

We should probably call it timeout instead of delay to more closely map with it's intended meaning.

from dyo.

Zolmeister avatar Zolmeister commented on June 9, 2024

Looks like React does timeout configuration through useTransition (though not sure of default).

from dyo.

thysultan avatar thysultan commented on June 9, 2024

Per facebook/react#19703 it looks like they removed that config opt.

from dyo.

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.