Fix deletion of route (#4466)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Hariom Balhara
2022-09-14 10:10:52 +00:00
committed by GitHub
co-authored by kodiakhq[bot]
parent 8b69359ccb
commit 45059554b6
2 changed files with 5 additions and 11 deletions
@@ -193,17 +193,10 @@ const Route = ({
label={route.isFallback ? "Fallback Route" : `Route ${index + 1}`}
deleteField={{
check: () => routes.length !== 1 && !route.isFallback,
fn: () => (
<button className="ml-5" type="button">
<Icon.FiTrash
className="m-0 h-4 w-4 text-neutral-500"
onClick={() => {
const newRoutes = routes.filter((r) => r.id !== route.id);
setRoutes(newRoutes);
}}
/>
</button>
),
fn: () => {
const newRoutes = routes.filter((r) => r.id !== route.id);
setRoutes(newRoutes);
},
}}>
<div className="-mx-4 mb-4 flex w-full items-center sm:mx-0">
<div className="cal-query-builder w-full ">
+1
View File
@@ -46,6 +46,7 @@ export default function FormCard({
<span className="text-sm font-semibold leading-none">{label}</span>
{deleteField?.check() ? (
<button
type="button"
onClick={() => {
deleteField?.fn();
}}