Skip to content

[lit-query]: options defined as a function cause page to crash #10715

@EskiMojo14

Description

@EskiMojo14

Describe the bug

When options are passed as a function to createQueryController, the page seems to freeze and eventually crash.

  pokeData = createQueryController(
    this,
    () => ({
      queryKey: ['pokemon', this.pokemon],
      queryFn: ({ signal }) =>
        fetch(`https://pokeapi.co/api/v2/pokemon/${this.pokemon}`, {
          signal
        }).then((r) => r.json())
    }),
    queryClient
  );

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/bitter-cherry-4cnvrx

Steps to reproduce

  1. Open playground
  2. Notice iframe page crashes
  3. change src/poke-display so non-function options are used
  4. Notice no crash

Expected behavior

Functions should be used to create options without crashing.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: MacOS
  • Browser: Chrome
  • Browser version: 148.0.7778.168

Tanstack Query adapter

None

TanStack Query version

v0.2.1

TypeScript version

v6.0.3

Additional context

No response

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