Skip to content

2.0.0 | untrack still tracks with uninitialized async read. [docs or api improvements ] #3007

Closed

Description

@mizulu

Describe the bug

reading an async dependency that is not ready in untrack()
is technically still tracked by the mechanism of Async graph resolution.

this should be documented and seem to be missing from https://v2.solidjs.com/reference/solid-js/reactivity/untrack

Image

untrack( asyncDep() ) propagates the NotReady error to the owner
and owner reruns when asyncDep is first resolved.

we should consider adding a simple way for the user to opt out of Loading failure
and provide the non reactive fallback value.

createSignal(()=>{
   // this will truly be untrack, getColor()  resolving will not rerun this function
    const color = untrack(()=>getColor(),  "red" ) 
   return color 
})

This still participate in Async NotReady

createSignal(()=>{
    const color = untrack(()=>getColor() ) 
    return color
})

Your Example Website or App

.

Steps to Reproduce the Bug or Issue

.

Expected behavior

.

Screenshots or Videos

No response

Platform

.

Additional context

The suggested api change for untrack can be implemented in user space using a loading boundary guard

function untrack(fn,defaultValue=undefined) {
  if(defaultValue === undefined){
    return _untrack(fn)
  } 
  return untrack(createLoadingBoundary(()=>_untrack(fn), () => {
    return defaultValue
  }));
}

https://s.olid.uk/id/X_X0G18AQ5Cm5MLddNl_fg

the change might be a low priority, and will depends widely on how untrack is being used in the wild.
to see if it is worth adding, only current consideration if we are not adding this now, but may in the future
is the 2nd parameter of untrack can be an option object

either way docs wording for untrack should cover the exception tracking for uninitialized async read..

Activity

  1. ryansolid commented on Aug 17, 2026

    @ryansolid
    Member

    Thanks — you're right that this needs documenting, and the docs site is the correct home for it. Tracking that here: solidjs/solid-docs#1635.

    To confirm the behavior is intended: untrack opts out of dependency tracking, not of async settlement. A NotReadyError from an uninitialized async read propagates to the owner regardless — the owner suspends and re-runs once the source first resolves. Those are two separate mechanisms, and untrack only ever addresses the first.

    On the untrack(fn, fallback) suggestion: we're not going to add it. A fallback overload would let a computation silently commit a value derived from data that was never real ("red" when the actual color is still loading), which is exactly the class of stale-seed bug 2.0's async model is designed to make impossible. Opting out of settlement is a boundary/latest concern, not an untrack concern, and the existing primitives (isPending, latest, loading boundaries) cover the legitimate cases.

    Closing in favor of the docs issue.

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

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