@@ -67,7 +67,6 @@ import { TaskRunStatusCombo } from "~/components/runs/v3/TaskRunStatus";
6767import { ClockRotateLeftIcon } from "~/assets/icons/ClockRotateLeftIcon" ;
6868import { MachinePresetName } from "@trigger.dev/core/v3" ;
6969import { TaskTriggerSourceIcon } from "~/components/runs/v3/TaskTriggerSource" ;
70- import { Callout } from "~/components/primitives/Callout" ;
7170import { TaskRunTemplateService } from "~/v3/services/taskRunTemplate.server" ;
7271import { DeleteTaskRunTemplateService } from "~/v3/services/deleteTaskRunTemplate.server" ;
7372import { DeleteTaskRunTemplateData , RunTemplateData } from "~/v3/taskRunTemplate" ;
@@ -277,6 +276,7 @@ export default function Page() {
277276 } , [ queueFetcher . data ?. queues , defaultTaskQueue ] ) ;
278277
279278 const { triggerSource } = result ;
279+
280280 switch ( triggerSource ) {
281281 case "STANDARD" : {
282282 return (
@@ -345,7 +345,7 @@ function StandardTaskForm({
345345 ? actionData
346346 : undefined ;
347347
348- const lastRun = runs [ 0 ] ;
348+ const lastRun = runs . at ( 0 ) ;
349349
350350 const [ defaultPayloadJson , setDefaultPayloadJson ] = useState < string > (
351351 lastRun ?. payload ?? startingJson
@@ -443,13 +443,13 @@ function StandardTaskForm({
443443 onTemplateSelected = { ( template ) => {
444444 setPayload ( template . payload ?? "" ) ;
445445 setMetadata ( template . metadata ?? "" ) ;
446- // setTtlValue(template.ttlSeconds ?? "" );
447- // setConcurrencyKeyValue(template.concurrencyKey ?? "");
446+ setTtlValue ( template . ttlSeconds ?? 0 ) ;
447+ setConcurrencyKeyValue ( template . concurrencyKey ?? "" ) ;
448448 setMaxAttemptsValue ( template . maxAttempts ?? undefined ) ;
449- setMaxDurationValue ( template . maxDurationSeconds ?? undefined ) ;
450- setMachineValue ( template . machinePreset ?? undefined ) ;
449+ setMaxDurationValue ( template . maxDurationSeconds ?? 0 ) ;
450+ setMachineValue ( template . machinePreset ?? "" ) ;
451451 setTagsValue ( template . tags ?? [ ] ) ;
452- setQueueValue ( template . queue ) ;
452+ setQueueValue ( template . queue ?? undefined ) ;
453453 } }
454454 showTemplateCreatedSuccessMessage = { showTemplateCreatedSuccessMessage }
455455 />
@@ -806,18 +806,18 @@ function ScheduledTaskForm({
806806} ) {
807807 const environment = useEnvironment ( ) ;
808808
809- const lastRun = runs [ 0 ] ;
809+ const lastRun = runs . at ( 0 ) ;
810810
811811 const [ timestampValue , setTimestampValue ] = useState < Date | undefined > (
812- lastRun . payload . timestamp ?? new Date ( )
812+ lastRun ? .payload ? .timestamp ?? new Date ( )
813813 ) ;
814814 const [ lastTimestampValue , setLastTimestampValue ] = useState < Date | undefined > (
815- lastRun . payload . lastTimestamp
815+ lastRun ? .payload ? .lastTimestamp
816816 ) ;
817817 const [ externalIdValue , setExternalIdValue ] = useState < string | undefined > (
818- lastRun . payload . externalId
818+ lastRun ? .payload ? .externalId
819819 ) ;
820- const [ timezoneValue , setTimezoneValue ] = useState < string > ( lastRun . payload . timezone ?? "UTC" ) ;
820+ const [ timezoneValue , setTimezoneValue ] = useState < string > ( lastRun ? .payload ? .timezone ?? "UTC" ) ;
821821 const [ ttlValue , setTtlValue ] = useState < number | undefined > ( lastRun ?. ttlSeconds ) ;
822822 const [ concurrencyKeyValue , setConcurrencyKeyValue ] = useState < string | undefined > (
823823 lastRun ?. concurrencyKey
@@ -908,13 +908,14 @@ function ScheduledTaskForm({
908908 < RunTemplatesPopover
909909 templates = { templates }
910910 onTemplateSelected = { ( template ) => {
911- // setTtlValue(template.ttlSeconds ?? "" );
912- // setConcurrencyKeyValue(template.concurrencyKey ?? "");
911+ setTtlValue ( template . ttlSeconds ?? 0 ) ;
912+ setConcurrencyKeyValue ( template . concurrencyKey ?? "" ) ;
913913 setMaxAttemptsValue ( template . maxAttempts ?? undefined ) ;
914- setMaxDurationValue ( template . maxDurationSeconds ?? undefined ) ;
915- setMachineValue ( template . machinePreset ?? undefined ) ;
914+ setMaxDurationValue ( template . maxDurationSeconds ?? 0 ) ;
915+ setMachineValue ( template . machinePreset ?? "" ) ;
916916 setTagsValue ( template . tags ?? [ ] ) ;
917- setQueueValue ( template . queue ) ;
917+ setQueueValue ( template . queue ?? undefined ) ;
918+
918919 setTimestampValue ( template . scheduledTaskPayload ?. timestamp ) ;
919920 setLastTimestampValue ( template . scheduledTaskPayload ?. lastTimestamp ) ;
920921 setExternalIdValue ( template . scheduledTaskPayload ?. externalId ) ;
@@ -1413,7 +1414,7 @@ function RunTemplatesPopover({
14131414 className = "flex-1 text-left outline-none focus-custom"
14141415 >
14151416 < div className = "flex flex-col items-start" >
1416- < Paragraph variant = "small" className = "truncate" >
1417+ < Paragraph variant = "small/bright " className = "truncate" >
14171418 { template . label }
14181419 </ Paragraph >
14191420 < div className = "flex items-center gap-2 text-xs text-text-dimmed" >
0 commit comments