Bug #18116

Advanced search -> Search by properties -> Add crashes

Added by Peter Amstutz 13 days ago. Updated 4 days ago.

Status:
In Progress
Priority:
Normal
Assigned To:
Category:
Workbench2
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
(Total: 0.00 h)
Story points:
-

Description

Searching by property values in advanced search causes the app to crash.

  1. Open advanced search
  2. Select a property key
  3. select a property value
  4. Click on "Add"
  5. The page goes blank. The console has an error back trace but it is not very helpful because the code has been minified. Tested on pirca and ce8i5.

Subtasks

Task #18158: ReviewNewLucas Di Pentima

History

#1 Updated by Peter Amstutz 13 days ago

  • Description updated (diff)
  • Subject changed from Advanced search -> Search by properties -> Add crashes to "Advanced search -> Search by properties -> Add" crash

#2 Updated by Peter Amstutz 13 days ago

  • Assigned To set to Stephen Smith
  • Subject changed from "Advanced search -> Search by properties -> Add" crash to Advanced search -> Search by properties -> Add crashes

#3 Updated by Stephen Smith 11 days ago

  • Status changed from New to In Progress

#4 Updated by Lucas Di Pentima 11 days ago

Haven't found the reason for the app crash but I narrowed it down to the following:

diff --git a/src/components/chips/chips.tsx b/src/components/chips/chips.tsx
index 2a6fafc3..28b1f456 100644
--- a/src/components/chips/chips.tsx
+++ b/src/components/chips/chips.tsx
@@ -45,7 +45,7 @@ export const Chips = withStyles(styles)(

         renderChip = (value: Value, index: number) =>
             <Grid item key={index}>
-                <this.chip {...{ value }} />
+                {/* <this.chip {...{ value }} /> */}
             </Grid>

         type = 'chip';

To add more mystery to the subject, the Chips component is used on other parts of the app, and AFAICT doesn't make the app crash there.

#5 Updated by Lucas Di Pentima 10 days ago

There's evidently something wrong with chips.tsx code, and it seems to me that's unnecessarily complicated. This update makes things work:

diff --git a/src/components/chips/chips.tsx b/src/components/chips/chips.tsx
index 2a6fafc3..1f3d655b 100644
--- a/src/components/chips/chips.tsx
+++ b/src/components/chips/chips.tsx
@@ -43,10 +43,13 @@ export const Chips = withStyles(styles)(
             </Grid>;
         }

-        renderChip = (value: Value, index: number) =>
-            <Grid item key={index}>
-                <this.chip {...{ value }} />
+        renderChip = (value: Value, index: number) => {
+            const { deletable, getLabel } = this.props;
+            return <Grid item key={index}>
+                <Chip onDelete={deletable ? this.deleteValue(value) : undefined}
+                    label={getLabel !== undefined ? getLabel(value) : value} />
             </Grid>
+        }

         type = 'chip';

There's cleanup to do and confirming other users of the <Chips> component still work, and it would be good to know why the previous version failed on production only.

#6 Updated by Peter Amstutz 5 days ago

  • Target version changed from 2021-09-15 sprint to 2021-09-29 sprint

Also available in: Atom PDF