Skip to content

Add an option to opt out of result source map inside useSanityQuery when not needed #1410

@igorexa34314

Description

@igorexa34314

Is your feature request related to a problem? Please describe.

The current implementation of useSanityQuery always enables resultSourceMap due to a hard-coded value:

resultSourceMap: 'withKeyArraySelector',

When prerendering a website this causes the generated JSON payloads to become extremely large even when visual editing or live preview is not used.

Describe the solution you'd like to see

Make resultSourceMap configurable in useSanityQuery, for example via an option in the third argument or derived from module/runtime config.
This would allow disabling source maps in production / prerendered builds when visual editing is not needed, significantly reducing payload size.

Describe alternatives you've considered

  • Using transform option in the third argument of useSanityQuery to strip source map data manually.
  • Avoiding useSanityQuery entirely and falling back to useAsyncData with a custom Sanity client configuration.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions