@@ -2,7 +2,6 @@ import { conform, useForm } from "@conform-to/react";
22import { parse } from "@conform-to/zod" ;
33import {
44 BookOpenIcon ,
5- CheckIcon ,
65 InformationCircleIcon ,
76 LockClosedIcon ,
87 PencilSquareIcon ,
@@ -16,8 +15,7 @@ import {
1615 json ,
1716 redirectDocument ,
1817} from "@remix-run/server-runtime" ;
19- import { type RuntimeEnvironment } from "@trigger.dev/database" ;
20- import { Fragment , useState } from "react" ;
18+ import { useState } from "react" ;
2119import { typedjson , useTypedLoaderData } from "remix-typedjson" ;
2220import { z } from "zod" ;
2321import { InlineCode } from "~/components/code/InlineCode" ;
@@ -69,7 +67,7 @@ import {
6967import { EnvironmentVariablesRepository } from "~/v3/environmentVariables/environmentVariablesRepository.server" ;
7068import {
7169 DeleteEnvironmentVariable ,
72- EditEnvironmentVariable ,
70+ DeleteEnvironmentVariableValue ,
7371 EditEnvironmentVariableValue ,
7472} from "~/v3/environmentVariables/repository" ;
7573
@@ -108,7 +106,11 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
108106
109107const schema = z . discriminatedUnion ( "action" , [
110108 z . object ( { action : z . literal ( "edit" ) , ...EditEnvironmentVariableValue . shape } ) ,
111- z . object ( { action : z . literal ( "delete" ) , key : z . string ( ) , ...DeleteEnvironmentVariable . shape } ) ,
109+ z . object ( {
110+ action : z . literal ( "delete" ) ,
111+ key : z . string ( ) ,
112+ ...DeleteEnvironmentVariableValue . shape ,
113+ } ) ,
112114] ) ;
113115
114116export const action = async ( { request, params } : ActionFunctionArgs ) => {
@@ -148,12 +150,9 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
148150
149151 switch ( submission . value . action ) {
150152 case "edit" : {
151- logger . debug ( "ENVVARS edit" , { submission : submission . value } ) ;
152153 const repository = new EnvironmentVariablesRepository ( prisma ) ;
153154 const result = await repository . editValue ( project . id , submission . value ) ;
154155
155- logger . debug ( "ENVVARS edit result" , { result } ) ;
156-
157156 if ( ! result . success ) {
158157 submission . error . key = result . error ;
159158 return json ( submission ) ;
@@ -175,7 +174,7 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
175174 }
176175 case "delete" : {
177176 const repository = new EnvironmentVariablesRepository ( prisma ) ;
178- const result = await repository . delete ( project . id , submission . value ) ;
177+ const result = await repository . deleteValue ( project . id , submission . value ) ;
179178
180179 if ( ! result . success ) {
181180 submission . error . key = result . error ;
@@ -448,6 +447,7 @@ function DeleteEnvironmentVariableButton({
448447 < Form method = "post" { ...form . props } >
449448 < input type = "hidden" name = "id" value = { variable . id } />
450449 < input type = "hidden" name = "key" value = { variable . key } />
450+ < input type = "hidden" name = "environmentId" value = { variable . environment . id } />
451451 < Button
452452 name = "action"
453453 value = "delete"
0 commit comments