-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
apps: React-related fixes #9344
Conversation
<td>{refresh_progress}</td> | ||
<td>{refresh_button}</td> | ||
</tr> | ||
<tbody> |
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.
Ugh, is a tbody really always required in React? That sounds strange, it's entirely optional in HTML and only really useful if one needs to shove in additional things next to the tr?
pkg/apps/application.jsx
Outdated
@@ -80,11 +80,11 @@ class Application extends React.Component { | |||
|
|||
return description.map(paragraph => { | |||
if (paragraph.tag == 'ul') { | |||
return <ul>{paragraph.items.map(item => <li>{item}</li>)}</ul>; | |||
return <ul key={paragraph}>{paragraph.items.map(item => <li key={item}>{item}</li>)}</ul>; |
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 would repeat the entire paragraph text in the HTML, which seems rather useless and wasteful? What is the purpose of all these keys?
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.
Discussed in #9339 , the long paragraph text will not make it to the HTML
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.
But paragraph
is not a string...
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.
Replacing it with string paragraph-${index}
. Use of indexes is not preferred, but not anti-pattern and working.
It's a good practice to explicitly use the For that reason, I'll need to fix a few CSS selectors within |
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.
Thanks! LGTM then. I marked it as blocked, AFAIUI the check-storage PR has to land first, right?
Files under |
pkg/apps/utils.jsx
Outdated
@@ -91,7 +91,7 @@ export const show_error = ex => { | |||
if (ex.code == "cancelled") | |||
return; | |||
|
|||
if (ex.code == "not-found") | |||
if (ex.code == "not-found" || ex.problem == "not-found") |
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.
Can you explain this more? ex.code
is from PackageKit, and ex.problem
is from cockpit-bridge. The first is "not-found" when the package was not known to PackageKit, the latter is "not-found" when PackageKit itself isn't there.
Let's move this out into its own PR.
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.
To be honest, I did not dig into details of this. Test was failing here and while debugging I watched for content of the ex
. I will need to start over to give proper answer to your question.
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.
Let's leave this out here, then.
pkg/apps/application-list.jsx
Outdated
@@ -140,18 +140,20 @@ class ApplicationList extends React.Component { | |||
tbody = <tr className="app-list-empty"><td>{empty_caption}</td></tr>; | |||
} else { | |||
table_classes += " table-hover"; | |||
tbody = comps.map((c) => <ApplicationRow comp={c} />); | |||
tbody = comps.map((c) => <ApplicationRow comp={c} key={c} />); |
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.
c
is not a string. c.id
should work.
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.
ok
pkg/apps/application.jsx
Outdated
@@ -62,7 +62,7 @@ class Application extends React.Component { | |||
function render_homepage_link(urls) { | |||
return urls.map(url => { | |||
if (url.type == 'homepage') { | |||
return (<div className="app-links"> | |||
return (<div className="app-links" key={url}> |
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.
url.link
should work
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.
ok
pkg/apps/application.jsx
Outdated
} else if (paragraph.tag == 'ol') { | ||
return <ol>{paragraph.items.map(item => <li>{item}</li>)}</ol>; | ||
return <ol key={paragraph}>{paragraph.items.map(item => <li key={item}>{item}</li>)}</ol>; |
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.
Key is not a string.
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.
fixed via indexes. Or anything better (natural key)?
pkg/apps/application.jsx
Outdated
@@ -127,7 +127,7 @@ class Application extends React.Component { | |||
{render_homepage_link(comp.urls)} | |||
<div className="app-description">{render_description(comp.description)}</div> | |||
<center> | |||
{ comp.screenshots.map(s => <img className="app-screenshot" role="presentation" src={s.full} />) } | |||
{ comp.screenshots.map(s => <img key={s} className="app-screenshot" role="presentation" src={s.full} />) } |
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.
Key is not a string.
pkg/apps/application.jsx
Outdated
} else { | ||
return <p>{paragraph}</p>; | ||
return <p key={paragraph}>{paragraph}</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.
Key is not a string.
Fixed, can you have a look, please? I'm using array indexes to build the |
React related changes look good to me now, thanks! The D-Bus fix should not be in this PR. It might or might not be a good fix, but it's unclear what it is fixing, and not related to React. |
And fix <table><tbody> hierarchy for React.
I have removed the D-Bus fix from this PR. |
Part of #9263 PR-split, see individual commits for more info.
The DBus-related issue was observed in tests when working on #9263.