-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering undefined values #719
base: main
Are you sure you want to change the base?
Rendering undefined values #719
Conversation
packages/bits/package.json
Outdated
@@ -142,7 +142,7 @@ | |||
"a11y": "start-server-and-test serve-examples:prod 4200 a11y:base", | |||
"a11y:base": "yarn run e2e:base --suite a11y", | |||
"a11y:ci": "yarn run e2e:ci --suite a11y", | |||
"assemble": "run-s prettier-check lint build-lib:locl build-lib:prod compodoc-custom-theme build-examples:prod build-schematics", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert changes in package.json (removing prettier-check and lint serves only for making local development faster)
@@ -125,4257 +129,4261 @@ export const GRAPH_DATA_MOCK = { | |||
}, | |||
], | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't comment out previous mock data. This can potentially break other tests
@@ -286,6 +286,7 @@ const widgetConfig: IWidget = { | |||
// drillstate: [""], | |||
groupBy: ["continent.name"], | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run prettier + lint locally before reviews
</nui-repeat> | ||
|
||
<div class="empty" *ngIf="!shouldDisplayRepeat()"> | ||
<nui-image image="no-data-to-show"></nui-image> | ||
<p>EMPTY VOBSHE</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vobshe?
} | ||
|
||
public ngOnChanges(changes: SimpleChanges): void { | ||
//this.data = [true,false, 1, 0, "", undefined, null, "ajajaja"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary comments
} | ||
|
||
public ngOnChanges(changes: SimpleChanges): void { | ||
//this.data = [true,false, 1, 0, "", undefined, null, "ajajaja"] | ||
this.data = this.data?.map((x) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will loop through all values after each change (since it is in ngOnChanges function). If there are many values, won't that slow down performance?
@@ -86,6 +99,50 @@ export class ListWidgetComponent | |||
this.eventBus.getStream(DRILLDOWN).next({ payload: item }); | |||
} | |||
|
|||
public getDisplayText(item: any): string { | |||
if (item === undefined || item === "undefined") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about empty array [], empty object {}, object which contains empty array, etc..
|
||
public dismissNavigation(data: SimpleChanges) { | ||
if (this.data?.length > 0) { | ||
console.log(this.configuration.itemProperties); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use console.log only locally but don't merge it into main branch
please rebase on latest master |
Frontend Pull Request Description
Hey, I created function which renders the specific values for undefined or false values. In the case the data contains null, undefined, false and etc. In case of undefined or null data was not rendering values after null or undefined because those values do not have properties, so it was error in console, so I mapped data and when I was rendering the data I turned undefined or null values to string "undefined" or "null" and it continued working. I render string and "-" for false or undefined values. Strings can be changed to specific values whatever will be necessary from function. I run spec.ts file also with additional case and it doesn't break any other code. There are no errors in console.
Checklist
Screenshots (if applicable)
Additional Context (if necessary)