Skip to content

Strategy to handle tanstack's CancelledError #252

@patroza

Description

@patroza

Right now when we use a tanstack query, either adhoc via useSafeQuery or as suspense via useSafeSuspenseQuery,
when the user navigates away, Tanstack throws a CancelledError, which we catch as defect and then classically report to Sentry.
We also filter for it in nuxt error boundaries in two separate places.

It seems to me it would be better if the resulting effect instead gets the interrupted status, and interrupted errors are not reported to Sentry.
As you can't interrupt an effect, only a fiber, here's an example workaround we might add to

pseudo

                  Effect.catchAllDefect((defect) =>
                    `${defect}`.includes("CancelledError") ? Exit.interrupt(FiberId.none) : Effect.die(defect)
                  ),

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