Skip to content

Commit

Permalink
fix: Empty conditions default false
Browse files Browse the repository at this point in the history
  • Loading branch information
adityachoudhari26 committed Oct 9, 2024
1 parent fa49db9 commit e2b19bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export const EnvironmentDrawer: React.FC = () => {
{environment?.name}
</DrawerTitle>

<div className="flex w-full gap-6 p-6">
<div className="flex w-full gap-6">
{environment != null && workspace != null && (
<div className="w-full space-y-12 overflow-auto">
<EnvironmentForm environment={environment} />
Expand Down
3 changes: 1 addition & 2 deletions packages/db/src/schema/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ const buildCondition = (tx: Tx, cond: ReleaseCondition): SQL => {
if (cond.type === ReleaseFilterType.Version)
return buildVersionCondition(cond);

if (cond.conditions.length === 0 && cond.not) return sql`FALSE`;
if (cond.conditions.length === 0) return sql`TRUE`;
if (cond.conditions.length === 0) return sql`FALSE`;

const subCon = cond.conditions.map((c) => buildCondition(tx, c));
const con =
Expand Down
3 changes: 1 addition & 2 deletions packages/db/src/schema/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ const buildCondition = (tx: Tx, cond: TargetCondition): SQL => {
if (cond.type === "name") return like(target.name, cond.value);
if (cond.type === "provider") return eq(target.providerId, cond.value);

if (cond.conditions.length === 0 && cond.not) return sql`FALSE`;
if (cond.conditions.length === 0) return sql`TRUE`;
if (cond.conditions.length === 0) return sql`FALSE`;

const subCon = cond.conditions.map((c) => buildCondition(tx, c));
const con = cond.operator === "and" ? and(...subCon)! : or(...subCon)!;
Expand Down

0 comments on commit e2b19bd

Please sign in to comment.