Skip to content

Data should be readonly #10056

@fedee13

Description

@fedee13

Describe the bug

I'm trying to mock some data because the type for data is Ref, but according to the warning is a redonly one?
https://vuejs.org/api/reactivity-core#readonly

const {
  data: ladders,
  isLoading,
  refetch
} = useQuery<LadderListResponse[]>({
  queryKey: ['ladders'],
  queryFn: () => competitionsApi.getLadders(),
  initialData: [],
  placeholderData: []
});

onMounted(async () => {
  await refetch();
  ladders.value = [
    {
      id: 1,
      name: 'Ladder 1',
      type: 'classic',
      visibility: 'public'
    }
  ];
});
Image

Your minimal, reproducible example

Explained in description

Steps to reproduce

Explained in description

Expected behavior

Being able to modify data or change the type of it

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: macOS, Windows, Linux, iOS, Android
  • Browser: Chrome, Safari, Firefox

Tanstack Query adapter

vue-query

TanStack Query version

5.92.7

TypeScript version

5.9.3

Additional context

vue - 3.5.26

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