Does not fit on this branch, but updated the key value, so it is concat of both id and index of the map function for search results. It was prev just the index, and when rapped this hits same value, which is unacceptable by react.

This commit is contained in:
2017-10-07 14:52:49 +02:00
parent d9a22f506e
commit 42d0b40825
2 changed files with 11 additions and 3 deletions

View File

@@ -31,9 +31,14 @@ class RequestElement extends React.Component {
createHTMLElement(data, index) {
var posterPath = 'https://image.tmdb.org/t/p/w300' + data.image_path;
if (data.user_agent !== null) {
if (data.user_agent) {
var user_agent = data.user_agent.split(" ");
var agent_shortened = user_agent[1].replace(/[\(\;]/g, '')
console.log(data.user_agent.substring('Mozilla'))
if (data.user_agent.includes('Mozilla'))
var agent_shortened = user_agent[1].replace(/[\(\;]/g, '');
else
var agent_shortened = user_agent[0];
}
return (
@@ -42,6 +47,7 @@ class RequestElement extends React.Component {
<div style={requestElement.infoDiv}>
<span><b>Name</b>: {data.name} </span>
<span><b>Year</b>: {data.year}</span><br></br>
<span><b>Type</b>: {data.type}</span><br></br>
<span><b>Status</b>: {data.status}</span><br></br>
<span><b>Address</b>: {data.ip}</span><br></br>
<span><b>Requested Data:</b> {data.requested_date}</span><br></br>

View File

@@ -35,6 +35,8 @@ class MovieObject {
}
getElement(index) {
const element_key = index + this.id;
// TODO set the poster image async by updating the dom after this is returned
if (this.poster == null || this.poster == undefined) {
var posterPath = 'https://openclipart.org/image/2400px/svg_to_png/211479/Simple-Image-Not-Found-Icon.png'
@@ -60,7 +62,7 @@ class MovieObject {
return (
<div key={index}>
<div key={element_key}>
<Notifications />
<div style={movieStyle.resultItem} key={this.id}>
<MediaQuery minWidth={600}>