Skip to content

[solid] Refetching query inside <Suspense> resets focus #5010

@KamehamehaNudel

Description

@KamehamehaNudel

Describe the bug

Using a query created with createQuery insided a SolidJs componenet causes inputs to lose focus whenever the query refetches.

Your minimal, reproducible example

https://stackblitz.com/edit/solid-vite-dlveck?file=src/index.tsx

Steps to reproduce

  1. Go to https://stackblitz.com/edit/solid-vite-dlveck?file=src/index.tsx
  2. Focus the first input beneath "tanstack query with suspense"
  3. The input will loose focus whenever the query updates/refetches
  4. (Updates are happening in 2 second intervall by the signal used as the query key updating from the setInterval)

Expected behavior

As a user i expected the focus to remain on the input element.
That behaviour can also be seen in the example below it "Tanstack query without suspense"

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: windows 11
  • Browser: firerfox 110.0

TanStack Query version

v4.24.4

TypeScript version

No response

Additional context

I added an additional example "vanilla resource with suspense" with just the solidjs native "createResource" and suspense. I understand it is not 100% applicable to expect tanstack query to behave the same but i figured it might serve as indication that the issue is not a general bug with solid's suspense component.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions