fix(sync): fetch sessions in active directory (#1231)
Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
committed by
GitHub
co-authored by
Isaac Sanchez
parent
416a11dcce
commit
65c54411de
@@ -189,7 +189,7 @@ export function useSync() {
|
|||||||
const fetchMessages = useCallback(
|
const fetchMessages = useCallback(
|
||||||
async (sessionID: string, limit: number, before?: string) => {
|
async (sessionID: string, limit: number, before?: string) => {
|
||||||
const result = await retry(() =>
|
const result = await retry(() =>
|
||||||
sdk.session.messages({ sessionID, limit, before }),
|
sdk.session.messages({ sessionID, directory, limit, before }),
|
||||||
)
|
)
|
||||||
const items = (result.data ?? []).filter((x: { info?: { id?: string } }) => !!x?.info?.id)
|
const items = (result.data ?? []).filter((x: { info?: { id?: string } }) => !!x?.info?.id)
|
||||||
const session = items
|
const session = items
|
||||||
@@ -202,7 +202,7 @@ export function useSync() {
|
|||||||
const cursor = result.response?.headers?.get?.("x-next-cursor") ?? undefined
|
const cursor = result.response?.headers?.get?.("x-next-cursor") ?? undefined
|
||||||
return { session, part, cursor, complete: !cursor }
|
return { session, part, cursor, complete: !cursor }
|
||||||
},
|
},
|
||||||
[sdk],
|
[sdk, directory],
|
||||||
)
|
)
|
||||||
|
|
||||||
// Load messages for a session
|
// Load messages for a session
|
||||||
@@ -286,7 +286,7 @@ export function useSync() {
|
|||||||
// Fetch session info if needed
|
// Fetch session info if needed
|
||||||
if (!hasSession || force) {
|
if (!hasSession || force) {
|
||||||
try {
|
try {
|
||||||
const result = await retry(() => sdk.session.get({ sessionID }))
|
const result = await retry(() => sdk.session.get({ sessionID, directory }))
|
||||||
if (result.data) {
|
if (result.data) {
|
||||||
const s = store.getState()
|
const s = store.getState()
|
||||||
const sessions = [...s.session]
|
const sessions = [...s.session]
|
||||||
|
|||||||
Reference in New Issue
Block a user