Skip to content

Commit

Permalink
feat: support perspectives in listenQuery (#4878)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars authored Sep 18, 2023
1 parent f7f92bf commit 6020a46
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SanityClient} from '@sanity/client'
import type {ClientPerspective, SanityClient} from '@sanity/client'
import {asyncScheduler, defer, merge, Observable, of, partition, throwError, timer} from 'rxjs'
import {filter, mergeMap, share, take, throttleTime} from 'rxjs/operators'
import {exhaustMapWithTrailing} from 'rxjs-exhaustmap-with-trailing'
Expand All @@ -13,6 +13,7 @@ export type ListenQueryParams = Record<string, string | number | boolean | strin
export interface ListenQueryOptions {
tag?: string
apiVersion?: string
perspective?: ClientPerspective
throttleTime?: number
transitions?: ('update' | 'appear' | 'disappear')[]
}
Expand All @@ -24,10 +25,10 @@ const fetch = (
options: ListenQueryOptions,
) =>
defer(() =>
// getVersionedClient(options.apiVersion)
client.observable.fetch(query, params, {
tag: options.tag,
filterResponse: true,
perspective: options.perspective,
}),
)

Expand All @@ -38,7 +39,6 @@ const listen = (
options: ListenQueryOptions,
) =>
defer(() =>
// getVersionedClient(options.apiVersion)
client.listen(query, params, {
events: ['welcome', 'mutation', 'reconnect'],
includeResult: false,
Expand Down

2 comments on commit 6020a46

@vercel
Copy link

@vercel vercel bot commented on 6020a46 Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio.sanity.build
performance-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 6020a46 Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.