Skip to content

Commit

Permalink
fix: replace nullish coalescing op with or op to account for empty st…
Browse files Browse the repository at this point in the history
…ring falsy values
  • Loading branch information
robhyrk committed Feb 13, 2024
1 parent 25cd5f9 commit 4f8847a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/create/editor/Publishing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const Publishing = ({ editor, creationParams }: PublishingProps) => {
editor.form.moderation === "Permissionless" &&
editor.form.liquidity?.deploy &&
editor.form.currency === "ZTG"
? new Decimal(editor.form.liquidity.amount ?? 0).toNumber()
? new Decimal(editor.form.liquidity.amount || 0).toNumber()
: 0,
)
.plus(ztgTransactionFee ?? 0);
Expand All @@ -121,7 +121,7 @@ export const Publishing = ({ editor, creationParams }: PublishingProps) => {

const foreignCurrencyCost =
editor.form.liquidity?.deploy && editor.form.currency !== "ZTG"
? new Decimal(editor.form.liquidity.amount ?? 0)
? new Decimal(editor.form.liquidity.amount || 0)
.mul(2)
.plus(baseAssetTransactionFee ?? 0)
: null;
Expand Down Expand Up @@ -314,7 +314,7 @@ export const Publishing = ({ editor, creationParams }: PublishingProps) => {
</h4>
<div className="">
{new Decimal(
editor.form.liquidity.amount ?? 0,
editor.form.liquidity.amount || 0,
).toFixed(1)}{" "}
{editor.form.currency}
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/state/market-creation/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export const useMarketDraftEditor = (): MarketDraftEditor => {
...draft.form,
liquidity: {
...draft.form.liquidity,
amount: draft.form.liquidity.amount ?? liquidity,
amount: draft.form.liquidity.amount || liquidity,
rows,
},
},
Expand Down

0 comments on commit 4f8847a

Please sign in to comment.