Skip to content

Commit

Permalink
fix: fix conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
zchenwei authored and hein-j committed Dec 7, 2022
1 parent ef5ea3c commit daf5a0b
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -1678,7 +1683,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -2309,7 +2319,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -3089,7 +3104,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -3779,7 +3799,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -4851,7 +4876,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -5391,7 +5421,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -5837,7 +5872,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -6297,7 +6337,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -6755,7 +6800,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -7295,7 +7345,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -8345,7 +8400,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -8850,7 +8910,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -9317,7 +9382,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -9927,7 +9997,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -10499,7 +10574,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -11043,7 +11123,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -11909,7 +11994,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -12826,7 +12916,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down Expand Up @@ -13836,7 +13931,12 @@ function ArrayField({
setSelectedBadgeIndex(undefined);
};
const addItem = async () => {
if (currentFieldValue && !hasError) {
if (
currentFieldValue !== undefined &&
currentFieldValue !== null &&
currentFieldValue !== \\"\\" &&
!hasError
) {
const newItems = [...items];
if (selectedBadgeIndex !== undefined) {
newItems[selectedBadgeIndex] = currentFieldValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,27 @@ export const generateArrayFieldComponent = () => {
[
factory.createIfStatement(
factory.createBinaryExpression(
factory.createIdentifier('currentFieldValue'),
factory.createBinaryExpression(
factory.createBinaryExpression(
factory.createBinaryExpression(
factory.createIdentifier('currentFieldValue'),
factory.createToken(SyntaxKind.ExclamationEqualsEqualsToken),
factory.createIdentifier('undefined'),
),
factory.createToken(SyntaxKind.AmpersandAmpersandToken),
factory.createBinaryExpression(
factory.createIdentifier('currentFieldValue'),
factory.createToken(SyntaxKind.ExclamationEqualsEqualsToken),
factory.createNull(),
),
),
factory.createToken(SyntaxKind.AmpersandAmpersandToken),
factory.createBinaryExpression(
factory.createIdentifier('currentFieldValue'),
factory.createToken(SyntaxKind.ExclamationEqualsEqualsToken),
factory.createStringLiteral(''),
),
),
factory.createToken(SyntaxKind.AmpersandAmpersandToken),
factory.createPrefixUnaryExpression(
SyntaxKind.ExclamationToken,
Expand Down

0 comments on commit daf5a0b

Please sign in to comment.