-
Notifications
You must be signed in to change notification settings - Fork 124
fix: actor runners by name query #3100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,7 +5,7 @@ import type { ActorId } from "./queries"; | |||||
|
||||||
type RequestOptions = Parameters<typeof createActorInspectorClient>[1]; | ||||||
|
||||||
export const defaultActorContext = { | ||||||
export const createDefaultActorContext = ({ hash }: { hash: string } = {}) => ({ | ||||||
createActorInspectorFetchConfiguration: ( | ||||||
actorId: ActorId | string, | ||||||
): RequestOptions => ({ | ||||||
|
@@ -32,7 +32,7 @@ export const defaultActorContext = { | |||||
enabled: false, | ||||||
refetchInterval: 1000, | ||||||
...opts, | ||||||
queryKey: ["actor", actorId, "ping"], | ||||||
queryKey: [hash, "actor", actorId, "ping"], | ||||||
queryFn: async ({ queryKey: [, actorId] }) => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.ping.$get(); | ||||||
|
@@ -51,7 +51,7 @@ export const defaultActorContext = { | |||||
return queryOptions({ | ||||||
enabled, | ||||||
refetchInterval: 1000, | ||||||
queryKey: ["actor", actorId, "state"], | ||||||
queryKey: [hash, "actor", actorId, "state"], | ||||||
queryFn: async ({ queryKey: [, actorId] }) => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.state.$get(); | ||||||
|
@@ -74,7 +74,7 @@ export const defaultActorContext = { | |||||
return queryOptions({ | ||||||
enabled, | ||||||
refetchInterval: 1000, | ||||||
queryKey: ["actor", actorId, "connections"], | ||||||
queryKey: [hash, "actor", actorId, "connections"], | ||||||
queryFn: async ({ queryKey: [, actorId] }) => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.connections.$get(); | ||||||
|
@@ -93,7 +93,7 @@ export const defaultActorContext = { | |||||
) { | ||||||
return queryOptions({ | ||||||
enabled, | ||||||
queryKey: ["actor", actorId, "database"], | ||||||
queryKey: [hash, "actor", actorId, "database"], | ||||||
queryFn: async ({ queryKey: [, actorId] }) => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.db.$get(); | ||||||
|
@@ -142,7 +142,7 @@ export const defaultActorContext = { | |||||
enabled, | ||||||
staleTime: 0, | ||||||
gcTime: 5000, | ||||||
queryKey: ["actor", actorId, "database", table], | ||||||
queryKey: [hash, "actor", actorId, "database", table], | ||||||
queryFn: async ({ queryKey: [, actorId, , table] }) => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The query key destructuring pattern doesn't account for the hash parameter that was added to the query key array. The current pattern
Suggested change
Spotted by Diamond This comment came from an experimental review—please leave feedback if it was helpful/unhelpful. Learn more about experimental comments here. |
||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.db.$post({ | ||||||
|
@@ -163,7 +163,7 @@ export const defaultActorContext = { | |||||
return queryOptions({ | ||||||
enabled, | ||||||
refetchInterval: 1000, | ||||||
queryKey: ["actor", actorId, "events"], | ||||||
queryKey: [hash, "actor", actorId, "events"], | ||||||
queryFn: async ({ queryKey: [, actorId] }) => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.events.$get(); | ||||||
|
@@ -182,7 +182,7 @@ export const defaultActorContext = { | |||||
) { | ||||||
return queryOptions({ | ||||||
enabled, | ||||||
queryKey: ["actor", actorId, "rpcs"], | ||||||
queryKey: [hash, "actor", actorId, "rpcs"], | ||||||
queryFn: async ({ queryKey: [, actorId] }) => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.rpcs.$get(); | ||||||
|
@@ -197,7 +197,7 @@ export const defaultActorContext = { | |||||
|
||||||
actorClearEventsMutationOptions(actorId: ActorId) { | ||||||
return { | ||||||
mutationKey: ["actor", actorId, "clear-events"], | ||||||
mutationKey: [hash, "actor", actorId, "clear-events"], | ||||||
mutationFn: async () => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
const response = await client.events.clear.$post(); | ||||||
|
@@ -211,7 +211,7 @@ export const defaultActorContext = { | |||||
|
||||||
actorWakeUpMutationOptions(actorId: ActorId) { | ||||||
return { | ||||||
mutationKey: ["actor", actorId, "wake-up"], | ||||||
mutationKey: [hash, "actor", actorId, "wake-up"], | ||||||
mutationFn: async () => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
try { | ||||||
|
@@ -233,7 +233,7 @@ export const defaultActorContext = { | |||||
refetchInterval: 1000, | ||||||
staleTime: 0, | ||||||
gcTime: 0, | ||||||
queryKey: ["actor", actorId, "auto-wake-up"], | ||||||
queryKey: [hash, "actor", actorId, "auto-wake-up"], | ||||||
queryFn: async ({ queryKey: [, actorId] }) => { | ||||||
const client = this.createActorInspector(actorId); | ||||||
try { | ||||||
|
@@ -246,13 +246,9 @@ export const defaultActorContext = { | |||||
retry: false, | ||||||
}); | ||||||
}, | ||||||
}; | ||||||
}); | ||||||
|
||||||
export type ActorContext = typeof defaultActorContext; | ||||||
|
||||||
export function createDefaultActorContext(): ActorContext { | ||||||
return defaultActorContext; | ||||||
} | ||||||
export type ActorContext = ReturnType<typeof createDefaultActorContext>; | ||||||
|
||||||
const ActorContext = createContext({} as ActorContext); | ||||||
|
||||||
|
Uh oh!
There was an error while loading. Please reload this page.