-
-
Notifications
You must be signed in to change notification settings - Fork 714
Run page links to tasks & replay run modal improvements #1364
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 19 commits
0ebd79e
b18129a
77455f3
77bd829
35bb7a2
701d5af
5a33a00
8425361
84c38c1
28af219
d538eca
7932a05
4ee4963
be23df4
3953e8b
9b1c664
ae9adb5
ba0ec21
ba60cb6
50d5680
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@trigger.dev/sdk": patch | ||
--- | ||
|
||
Removed the inline-code accessory from the logs when calling trigger or batchTrigger from a run |
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { useSearchParams } from "@remix-run/react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { useCallback } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export function useReplaceSearchParams() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const [searchParams, setSearchParams] = useSearchParams(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const replaceSearchParam = useCallback( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(key: string, value?: string) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
setSearchParams((s) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
s.set(key, value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
s.delete(key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[searchParams] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return { searchParams, setSearchParams, replaceSearchParam }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+4
to
+22
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. 🛠️ Refactor suggestion LGTM: Well-implemented custom hook with a minor optimization suggestion. The Consider removing const replaceSearchParam = useCallback(
(key: string, value?: string) => {
setSearchParams((s) => {
if (value) {
s.set(key, value);
} else {
s.delete(key);
}
return s;
});
},
- [searchParams]
+ [setSearchParams]
); This change is safe because 📝 Committable suggestion
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -132,6 +132,21 @@ export class SpanPresenter extends BasePresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
exportName: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rootTaskRun: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
select: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
taskIdentifier: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
friendlyId: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spanId: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parentTaskRun: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
select: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
taskIdentifier: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
friendlyId: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spanId: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
where: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spanId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -281,7 +296,15 @@ export class SpanPresenter extends BasePresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
outputType: finishedAttempt?.outputType ?? "application/json", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
error, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
links: span?.links, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
relationships: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
root: run.rootTaskRun | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
? { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
...run.rootTaskRun, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isParent: run.parentTaskRun?.friendlyId === run.rootTaskRun.friendlyId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
: undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parent: run.parentTaskRun ?? undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
context: JSON.stringify(context, null, 2), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
metadata, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -307,10 +330,29 @@ export class SpanPresenter extends BasePresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const triggeredRuns = await this._replica.taskRun.findMany({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
select: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
friendlyId: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
taskIdentifier: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spanId: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
createdAt: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
number: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lockedToVersion: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
select: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
version: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
where: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
parentSpanId: spanId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+333
to
+350
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. Potential performance issue: Consider implementing pagination or limiting the results for Fetching all Apply this diff to add a limit to the query: const triggeredRuns = await this._replica.taskRun.findMany({
select: {
friendlyId: true,
taskIdentifier: true,
spanId: true,
createdAt: true,
number: true,
lockedToVersion: {
select: {
version: true,
},
},
},
where: {
parentSpanId: spanId,
},
+ take: 100, // Limit the results to 100
}); Alternatively, consider adding pagination parameters to the query to allow clients to request specific ranges of results. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
...span, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
events: span.events, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
properties: span.properties ? JSON.stringify(span.properties, null, 2) : undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
triggeredRuns, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
showActionBar: span.show?.actions === true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.