Skip to content

isPending(..., true) is inconsistent with behaviour of Loading boundaries #2703

@GabbeV

Description

@GabbeV

isPending(..., true) differentiate between the source being initially pending or pending for this update. Loading also had this behavior before but that got changed/fixed as response to this issue: #2672.

What phase something is in should be based on the read instead of the source if these things are to be consistent.

This has been discussed on discord here: https://discord.com/channels/722131463138705510/780502110772658196/1504500656394997902

The fix would produce similar behavior to this:

function newIsPending(fn, loading) {
  if (loading) {
    fn(); // potentially try catch errors that aren't not ready errors here
  }
  return isPending(fn);
}

However reading fn twice would be nice to avoid if possible.

Here is a demo how the current isPending compared to this changed behaviour and how it composes with Loading boundaries.
https://s.olid.uk/id/kpIvSAwkQt6lfTbMUC6Q8g

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions