React app not updating after receiving data from SocketIO

I’m creating a chess website using React and SocketIO where two people can connect and play with each other. I created all of the movement logic and everything was working fine. You could play the game as black and white from the same computer. When I added SocketIO, the board stopped updating properly. When I move a piece, it sends the new board data to the server, and then to the other user in the room. It sends the data properly, then runs the canMove function, which is what I used to update the visual board. The canMove function is still running, and running with the correct/updated data, but the board doesn’t update.

All of the important code happens in Board.js and server.js

The codeSandbox is: https://codesandbox.io/p/github/Vastagon/online-chess/draft/happy-smoke?file=%2Fclient%2Fsrc%2Fcomponents%2FBoard.js. You can use the npm run dev command/task to update the board whenever you want to make a change.

tampermonkey script: linter said ‘Global variable leak’, functions are not exported

I had created this userscript to display the full path of both CSS and Xpath selectors. But I can’t figure out what the linter want to be valid (was valid before) for my functions to be exported in the DOM.

enter image description here

// ==UserScript==
// @name         retrieveCssOrXpathSelectorFromTextOrNode
// @namespace    gilles<dot>quenot<at>sputnick<dot>fr
// @version      0.2
// @description  retrieve CSS or Xpath Selector from text or node for chrome dev tools
// @author       Gilles Quenot
// @include      https://*
// @include      http://*
// @include      file://*
// @exclude      https://mail.google.com/*
// @grant        none
// ==/UserScript==

var xpathNamespaceResolver = {
    svg: 'http://www.w3.org/2000/svg',
    mathml: 'http://www.w3.org/1998/Math/MathML'
};

getElementByXPath = function getElementByXPath(expression) {
    var a = document.evaluate(expression, document.body, xpathNamespaceResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    if (a.snapshotLength > 0) {
        return a.snapshotItem(0);
    }
};


x = function(arg) {
    console.log("CSSn" + retrieveCssOrXpathSelectorFromTextOrNode(arg, 'css'));
    console.log("XPathn" + retrieveCssOrXpathSelectorFromTextOrNode(arg, 'xpath'));
    retrieveCssOrXpathSelectorFromTextOrNode = function(arg, type) {
        var root = [], node;
        nodeType = type.toLowerCase();
        function retrieveNodeNameAndAttributes(node) {
            var output = '';
            try {
                var nodeName = node.nodeName.toLowerCase();
            } catch(e) {
                console.error('ERROR no matching node');
                return;
            }
            if (node.hasAttributes()) {
                var attrs = node.attributes;
                for (var i = 0; i < attrs.length; i++) {
                    if (nodeType === 'xpath') {
                        if (attrs[i].value) {
                            output += '[@' + attrs[i].name + "='" + attrs[i].value + "']";
                        }
                        else {
                            output += '[@' + attrs[i].name + ']';
                        }
                    }
                    else if (nodeType === 'css') {
                        if (attrs[i].value) {
                            if (attrs[i].name === 'id') {
                                if (/:/.test(attrs[i].value)) {
                                    output += "[id='" + attrs[i].value + "']"; // new Ex: [id="foo:bar"]
                                }
                                else {
                                    output += "#" + attrs[i].value;
                                }
                            } else if (attrs[i].name === 'class') {
                                var classes = attrs[i].value.split(/s+b/).join('.');
                                output += '.' + classes;
                            } else {
                                output += "[" + attrs[i].name + "='" + attrs[i].value + "']";
                            }
                        }
                        else {
                            output += "[" + attrs[i].name + "]";
                        }
                    }
                }
            }

            var txt = '';
            if (nodeName === 'a' && nodeType === 'xpath') {
                txt = "[text()='" + node.innerText + "']";
            }

            root.push({ 'name': nodeName, 'attrs': output, txt });

            if (nodeName === 'body') return;
            else retrieveNodeNameAndAttributes(node.parentNode); // recursive function
        }

        if (typeof arg === 'string') { // text from within the page
            var selector = '//*[text()[contains(.,"' + arg + '")]]';
            node = getElementByXPath(selector);
        } else if (typeof arg === 'object') { // node argument, let's do some 'duck typing'
            if (arg && arg.nodeType) {
                node = arg;
            }
            else {
                console.error("ERROR expected node, get object");
                return;
            }
        } else {
            console.error("ERROR expected node or string argumument");
            return;
        }

        retrieveNodeNameAndAttributes(node);

        var output = '';
        if (nodeType === 'css') {
            output = root.reverse().map(elt => elt.name + elt.attrs ).join(' > ');
        }
        else if (nodeType === 'xpath') {
            output = '//' + root.reverse().map(elt => elt.name + elt.txt + elt.attrs ).join('/');
        }
        else {
            console.error('ERROR unknown type ' + type);
        }

        return output;
        //console.log(output);

    };
};

How do i make a pattern repeat while in a triangle [closed]

I need to create a triangle where it determines the symbols in the triangle based off of check boxes being marked or not. The triangle needs to print each of the characters before using the first character again. I am confused on how to make it so that the code will do the repeating part, how do i make it print one of each before starting again.

This is what I have, I really just need how to do the triangle and ill be good to go.

Cannot save data from Ant Design

I tried making two input fields one for dimensions and one for weight, and both had seperate select drop down to allow the user to select a unit. I saw on Ant design docs that they had something similar, so I tried using that.

This is how I wanted it to be like:
enter image description here

Now i have filled my form with many other fields and they work just fine, on clicking the save button, I am not getting any data entered in the fields for dimensions or weight, nor their units. I have a standard save function which is called on ‘onFinish’ event:

const handleSubmit = (data) => {
  console.log('data', data);
  submit(data);
};
<Form
  {...formItemLayout}
  onFinish={handleSubmit}
  form={form}
  layout="horizontal"
  labelWrap='true'
  className="newItem"
  hideRequiredMark
>

This is my code to generate the fields.

<Row style={{ justifyContent: 'left' }}>
  {<Col span={8}>
    <div className="p-2 lbh-input">
      <Form.Item
        name="dimensions"
        key="dimensions"
        label="Dimensions &nbsp;&nbsp; (l x b x h)">
        <Input.Group>
          <Input
            key='length'
            name='length'
            style={{ width: '15%' }}
            type="number"
          />
          <Input
            key='breadth'
            name='breadth'
            style={{ width: '24%' }}
            addonBefore="x"
            type="number"
          />
          <Input
            key='height'
            name='height'
            style={{ width: '25%' }}
            addonBefore="x"
            type="number"
          />
          <Select name='dimension_unit' key='dimension_unit' defaultValue="cm">
            <Option value="mm">mm</Option>
            <Option value="cm">cm</Option>
            <Option value="inch">inch</Option>
            <Option value="feet">feet</Option>
            <Option value="m">m</Option>
          </Select>
        </Input.Group>
      </Form.Item>
    </div>
  </Col>
  }
  {
    <div className="p-2">
      <Form.Item
        key="weight"
        name="weight"
        label="Weight">
        <Input.Group>
          <Input
            style={{ width: '50%' }}
            type="number"
            key="weight"
            name="weight"
            label="Weight"
            className='noborderradius'
          />
          <Select defaultValue="kg" name="weight_unit" key="weight_unit">
            <Option value="kg">kg</Option>
            <Option value="tonne">tonne</Option>
            <Option value="g">g</Option>
          </Select>
        </Input.Group>
      </Form.Item>
    </div>}
</Row>

As you can see, i have tried using everythihg I can like label,name,key but no matter what happens, I get no data being sent no matter what I type in these two fields. What am i missing? Am i doing something wrong with <Form.item> ?
My ant design version is

"antd": "^4.3.4",

Material UI Modal not working in React, using example

I’m trying to copy the example of a modal from material UI but when I click on the button that displays the modal, nothing happens except a grey transparent overlay.

The state is being set when I console.log(open) so I’m not sure why nothing is happening

I used this example https://mui.com/material-ui/react-modal/

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import Modal from 'material-ui/Modal';
import Button from 'material-ui/Button';

const TaskDrawer = ({
  action
}) => {

const [open, setOpen] = React.useState(false);

function rand() {
  return Math.round(Math.random() * 20) - 10;
}

function getModalStyle() {
  const top = 50 + rand();
  const left = 50 + rand();

  return {
    top: `${top}%`,
    left: `${left}%`,
    transform: `translate(-${top}%, -${left}%)`,
  };
}

    const handleOpen = () => setOpen(true);
    const handleClose = () => setOpen(false);

  handleOpen() {
    this.setState({ open: true });
  };

  handleClose(){
    this.setState({ open: false });
  };

    return (
    <div>
      <h1>
        Tasks
      </h1>
      <div>
        {action == "Find" &&
            (
            <Button
                className="edit"
                onClick={handleOpen}
            >
                Edit
            </Button>     
        )}
      </div>
        <Modal
            open={open}
            onClose={handleClose}
        >
            <div style={getModalStyle()} className="modal">
                <h2 id="simple-modal-titile">Text in a modal </h2>
                <p id="simple-modal-description">test of a modal </p>
            </div>
        </Modal>   
      <Grid container spacing={3}>
        {Object.keys(tasks).map(k => getTask(k, tasks[k]))}
      </Grid>
    </div>
  );
};
export default taskDrawer;

how to fetch content of a webpage post-translation (after window.load event??)

I’m currently coding a Flask application with a simplified version of my code below.

#app.py
from flask import Flask, render_template, request

# Configure application"'

app = Flask(__name__)

# Ensure templates are auto-reloaded

app.config["TEMPLATES_AUTO_RELOAD"] = True

@app.route("/")
def index():
return render_template("gettranslation.html")

@app.route("/translate")
def translate():
word = request.args.get("word")
lang = request.args.get("lang")
return render_template("translate.html", lang = lang, word=word)

The default webpage should log a translation of the given words, but instead it just logs the word before translation, though when visited the webpage being fetched takes a second to load and then shows the correct translation. How do I fetch this correct translation?

Here is simplified code from my two files:

<!--translate.html-->
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

<div id="google_translate_element"></div>

<p id="to-translate">{{word}}</p>

<script>
    var lang = "{{ lang }}";
    var lang = lang[0] + lang[1];
    console.log(lang);
    function googleTranslateElementInit() {
        new google.translate.TranslateElement(
            {
                pageLanguage: lang
            },
            "google_translate_element"
        );
    }
    window.href = window.href + "/#googtrans(" + lang + "|en)";
</script>
<!--gettranslation.html-->

<script>
    async function translate(sourcelang, destlang, word){
        var url = '/translate?word=' + word + "&lang=" + sourcelang + "/#googtrans(" + sourcelang   + "|" + destlang + ")";
        console.log(url);
        let response = await fetch(url, {redirect: 'follow'});
        let text = await response.text();
        var parser = new DOMParser();
        var htmlDoc = parser.parseFromString(text, 'text/html');
        var translation = htmlDoc.getElementsByTagName('p')[0].innerHTML;
        console.log(translation);
    }
    translate("fr", "en", "bonjour");
</script>

I thought using await or redirect: follow would work but neither did. I also got the idea to use #googletrans(“source|dest”) from this question: Trigger Google Web Translate Element if that’s helpful.
Someone there saidthe Google translate select box is created after the window.load event triggers, so that is could be what is messing up my fetch request but if so I have no idea how to fix that.
Thanks in advance!

how can i optimize this jquery music player

i made this mp3 player for my music producer friend’s website to preview his beats, but it’s pretty buggy, and i suck at jquery, so i’m hoping someone a bit more knowledgeable could help me fix this up. any suggestions are greatly appreciated!

    $(document).ready(function() {

    var beats = {
        trackOne: new Audio("../mp3/track1.mp3"),
        trackTwo: new Audio("../mp3/track2.mp3"),
        trackThree: new Audio("../mp3/track3.mp3")
    }

    $('.track1 .cover').click(function() {
      beats["track1"].play();
      if ($('.track1 .control').hasClass('fa-play')) {
        $('.track1 .control').addClass('fa-pause');
        $('.track1 .control').removeClass('fa-play');
      }
      else {
        beats["track1"].pause();
        $('.track1 .control').addClass('fa-play');
        $('.track1 .control').removeClass('fa-pause');
      }
    });

    $('.track2 .track2').click(function() {
      beats["track2"].play();
      if ($('.track2 .control').hasClass('fa-play')) {
        $('.track2 .control').addClass('fa-pause');
        $('.track2 .control').removeClass('fa-play');
      }
      else {
        beats["track2"].pause();
        $('.track2 .control').addClass('fa-play');
        $('.track2 .control').removeClass('fa-pause');
      }
    });

    $('.track3 .track3').click(function() {
      beats["track3"].play();
      if ($('.track3 .control').hasClass('fa-play')) {
        $('.track3 .control').addClass('fa-pause');
        $('.track3 .control').removeClass('fa-play');
      }
      else {
        beats["track3"].pause();
        $('.track3 .control').addClass('fa-play');
        $('.track3 .control').removeClass('fa-pause');
      }
    });

what it looks like:

screenshot

I don’t know how to print all the values ​of an array

my name is Jan, I have to do a project for high school, the fact is that I have made a code to access an api, but I cannot display the results of an array that has the api on the screen.
This is the code :
`

document.querySelector("button").addEventListener("click", getCoin); 

function getCoin(){
    let coin = document.querySelector("input").value.split(" ").join(" ")
    console.log(coin)
    
    fetch("https://open.er-api.com/v6/latest/" + coin)
    .then (res => res.json())
    .then (data => {
      console.log(data.rates)
      

      
      document.querySelector("#coinName").innerText = data.base_code
      document.querySelector("#coinRates").innerText = data.rates
      document.querySelector("#coinProvider").innerText = data.provider
      document.querySelector("#coinTime").innerText = data.time_last_update_utc
      document.querySelector("#coinProxTime").innerText = data.time_next_update_utc
      
    })

}

`
It only works if I indicate a specific coin at document.querySelector(“#coinRates”).innerText = data.rates, and what I want is for it to show me all the values ​​on the screen.
I would be very grateful if you could help me.

I have tried with a querySelectALL, also with the for loop, although I think I have done it wrong

Java/JS/TS Given row and column get bit value in truthtable

Is their a short formula for calculating the bit value for a given row and column?
Example: getTTBit(row = 3, col = 2) = 1
4 2 1
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
It should be as quick as possible. I dont want to convert the row number into a bitarray and get the col’th element because I work with large numbers (rows)

Make a dynamic expiration date in Mongoose

I’m trying to get my Mongoose Schema Document to automatically expire itself after a specific date, the problem is that I want to make it expire itself based off of one of the Schema values. Currently I’m getting an error that says “Cannot read properties of undefined (reading ‘dateOfRequest’)”. I’m assuming this is because dateofRequest has not yet been initialized. How would I be able to set expiration date of the doc to dateOfRequest if it hasn’t been initialized yet?

const { date } = require('joi');
const mongoose = require('mongoose')
const Schema = mongoose.Schema;
const User = require('../models/user')

let requestSchema = new Schema(
    {
        restaurant : {type: String},
        party_size : {type: Number},
        dateOfRequest: {type: Date},
        time: {type: String},
        owner: {type: mongoose.Schema.Types.ObjectId, ref: User},
        dateCreated: {type: Date, default: Date.now, expiresAt: (new Date.setDate(mongoose.Schema.Types.request.dateOfRequest.getDate() + 1))}
        
    }
)

module.exports = mongoose.model("Request", requestSchema)

Data undefined error on loading of jade page

I have an express.js application that returns a list retrieved from a Postgresql database on a Jade webpage.
when clicking the link to the webpage I sometimes get an error: ‘cannot read properties of undefined.’
The weird thing is that this happens only around 50% of the time, the other times it works like intended

TypeError: C:UserskaspeDocumentsTrust kalenderappviewsgroup-detail.jade:24
    22|              each user in remaining_users 
    23|               option(value=user.Name + ' ' + user.LastName) #{user.Name + ' ' + user.LastName } 
  > 24|         if group_users.data <= 0
    25|            p No users in group    
    26|         else 
    27|           each user in group_users 

Cannot read properties of undefined (reading 'data')
    at eval (eval at exports.compile (C:UserskaspeDocumentsTrust kalenderappnode_modulesjadelibindex.js:218:8), <anonymous>:430:18)
    at eval (eval at exports.compile (C:UserskaspeDocumentsTrust kalenderappnode_modulesjadelibindex.js:218:8), <anonymous>:720:22)
    at res (C:UserskaspeDocumentsTrust kalenderappnode_modulesjadelibindex.js:219:38)
    at Object.exports.renderFile (C:UserskaspeDocumentsTrust kalenderappnode_modulesjadelibindex.js:380:38)
    at Object.exports.renderFile (C:UserskaspeDocumentsTrust kalenderappnode_modulesjadelibindex.js:370:21)
    at View.exports.__express [as engine] (C:UserskaspeDocumentsTrust kalenderappnode_modulesjadelibindex.js:417:11)
    at View.render (C:UserskaspeDocumentsTrust kalenderappnode_modulesexpresslibview.js:135:8)
    at tryRender (C:UserskaspeDocumentsTrust kalenderappnode_modulesexpresslibapplication.js:640:10)
    at Function.render (C:UserskaspeDocumentsTrust kalenderappnode_modulesexpresslibapplication.js:592:3)
    at ServerResponse.render (C:UserskaspeDocumentsTrust kalenderappnode_modulesexpresslibresponse.js:1008:7)

my server side code:

//Create a group detail page
router.get('/details', function (req, res, next) {
  if (req.session.loggedin) {
    var userssql = 'select * from "TrustCalendar"."User" where $1 = any ("User"."Groups")';
    var users_list;
    db.pool.query(userssql, [req.query.group], function (error, results) {
      if (error) {
        throw error;
      }
      users_list = results.rows;
    })

    //get user list of all users not in group
    var users_not_in_group_sql = 'select * from "TrustCalendar"."User" where not $1 = any("User"."Groups")';
    var users_not_in_group_list;
    db.pool.query(users_not_in_group_sql, [req.query.group], function(error, results){
      if(error) {
        throw error;
      }
      users_not_in_group_list = results.rows;
    })

    var sql = 'select * from "TrustCalendar"."Group" where lower("name") = lower($1)'
    db.pool.query(sql, [req.query.group], function (error, results) {
      //create custom object with all needed vars
      res.render('group-detail', { group: results.rows, training_hours: results.rows[0].training_hours, group_users: users_list, remaining_users: users_not_in_group_list });
    })

  } else {
    req.flash('error', 'Please log in!');
    res.redirect('/');
  }

})

my jade template code:

extends layout

block content
    h1 Group detail overview
    h2 #{group[0].name}

    p 
        a(href="/groups/trainings") Trainings 

    p Head of group
        p #{group[0].head_of_group} 
    p Trainers of #{group[0].name} 
      form(action="/groups/addtrainer?group=" + group[0].name, method="post")
        div add a user to #{group[0].name} 
        if remaining_users.length <= 0
          p All users are already in the group
        else 
          select(name="user" multiple='multiple' data-placeholder="Choose user(s)" class="chosen-select" required) 
             each user in remaining_users 
              option(value=user.Name + ' ' + user.LastName) #{user.Name + ' ' + user.LastName } 
        if group_users.data <= 0
           p No users in group    
        else 
          each user in group_users 
            p=user.Name + ' ' + user.LastName
            a(href="/groups/removetrainer?group="+group[0].name + '&user_name=' + user.Name + '&user_lname=' + user.LastName) remove trainer 

I tried changing .length to .data but it does not seem to make any difference.
I also made sure that the data that needs to be read is there which is also the case.
Does anyone know why the data fails to load half of the time?

React: Passing a graphql prop to another component

I have a dashboard with a table component inside it. I am making a graphql call in the dashboard and need to pass the data recieved into the table like this . However I can’t get the data to show up inside the table component.

Here is my approach. Please let me know what I’m missing

Dashboard.js

import React from "react";
import "bootstrap/js/src/collapse.js";
import DashboardTable from "../DashboardTable";
import { API } from "@aws-amplify/api";
import config from "../../aws-exports";
import * as queries from "../../graphql/queries";

export default function Dashboard() {
  var opportunityTable;

  API.configure(config);
  async function asyncCall() {
    const opportunityTable = await API.graphql({
      query: queries.listMockOppsTables,
    });
    // console.log(opportunityTable.data.listMockOppsTables); // result: { "data": { "listTodos": { "items": [/* ..... */] } } }
  }

  asyncCall();

  return (
    <div>
      <div className="container py-5">
        <DashboardTable
          data={opportunityTable.data.listMockOppsTables}
        ></DashboardTable>
      </div>
    </div>
  );
}

Table (receiving prop data)

import React from "react";
import "bootstrap/js/src/collapse.js";
require("../opportunityData.json");

export class Opportunity extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    var opportunityData = this.props.items;
    console.log(this.props); // returns nothing

    return (
      <div>
        <section class="py-5 mt-5">
          <div class="container py-5">
            <div class="table-responsive">
              <table class="table">
                <thead>
                  <tr>
                    <th>Shadow ID</th>
                    <th>Role Title</th>
                    <th>Interview Type</th>
                    <th>Level</th>
                    <th>Date and Time</th>
                    <th># Requests</th>
                    <th>Make Request</th>
                  </tr>
                </thead>
                {opportunityData.map((opportunity) => (
                  <tbody>
                    <tr>
                      <td>{opportunity.shadow_id}</td>
                      <td>{opportunity.job_title}</td>
                      <td>{opportunity.shadow_type}</td>
                      <td>4</td>
                      <td>
                        {opportunity.shadow_datetime}
                        <br />
                        {opportunity.shadow_datetime}
                      </td>
                      <td>2</td>
                      <td>
                        <div class="btn-group" role="group">
                          <button
                            class="btn btn-primary"
                            type="button"
                            style={{
                              backgroundColor: "#ff9900",
                              border: 0,
                            }}
                          >
                            Shadow
                          </button>
                          <button
                            class="btn btn-primary"
                            type="button"
                            style={{
                              backgroundColor: "#ffac2f",
                              border: 0,
                            }}
                          >
                            Reverse Shadow
                          </button>
                        </div>
                      </td>
                    </tr>
                  </tbody>
                ))}
              </table>
            </div>
          </div>
        </section>
      </div>
    );
  }
}
export default Opportunity;

Multiple FileUpload PrimeReact state management

I’m running into an issue here. What I’m trying to do essentially is having a form that has the doc name (in this case we’ll call it documents) and doc number and other fields, but not important at the moment. Within in this form a user can upload pdf files that are related to this one form and each file that has been uploaded has 2 drop downs that can associate user and country. That is what I want and need, however, it appears that the state management that I have as of now overwrites the selection of country and applies to all of them.

EX: Expected behavior

File 1: User: Danny M., Country: Mexico
File 2: User: Leo Messi, Country: Argentina
File 3: User: C. Ronaldo, Country: Portugal

Actual Behavior

File 1: User: Danny M., Country: Mexico <—- If I change just these two fields it reflects to all
File 2: User: Danny M., Country: Mexico
File 3: User: Danny M., Country: Mexico

The code as it follows below:

let document = {
        document_name: '',
        document_number: '',
        region: '',
        country: '',
        user: '',
        // Other fields
    }

const [documentInput, setDocumentInput] = useState<any>(document)

const onModalChange = (e: any) => {
        console.log(e.target)
        const { id, value } = e.target
        setDocumentInput({
             ...documentInput,
             [id]: value,
        })
    }

const itemTemplate = (file: any, props: any) => {
        return (
            <div className='flex align-items-center flex-wrap px-0 py-1'>
                <div className='inline-flex align-items-center'>
                    <label className='upload-label' htmlFor='user'>
                        Original Filename:
                    </label>
                    <span className='flex flex-column text-left ml-3'>
                        {file.name}
                        <small>{new Date().toLocaleDateString()}</small>
                    </span>
                </div>
                <Tag
                    value={props.formatSize}
                    severity='warning'
                    className='px-3 py-2'
                />
                <div className='inline-flex align-items-center'>
                    <label className='upload-label' htmlFor='user'>
                        User:
                    </label>
                    <AutoComplete
                        className='ml-3'
                        value={documentInput.user}
                        suggestions={filteredUsers}
                        completeMethod={searchUser}
                        field='label'
                        forceSelection
                        dropdown
                        id='language'
                        onChange={e => modalChange(e)}
                    />
                </div>
                <div className='inline-flex align-items-center'>
                    <label className='upload-label' htmlFor='country'>
                        Country:
                    </label>
                    <AutoComplete
                        className='ml-3'
                        value={documentInput.country}
                        suggestions={filteredCountries}
                        completeMethod={searchCountry}
                        field='label'
                        forceSelection
                        dropdown
                        id='country'
                        onChange={e => modalChange(e)}
                    />
                </div>
                <Button
                    type='button'
                    icon='pi pi-times'
                    className='p-button-outlined p-button-rounded p-button-danger ml-auto'
                    onClick={() => onTemplateRemove(file, props.onRemove)}
                />
            </div>
        )
    }

return(
    <>
        //Other fields
        <FileUpload
            ref={fileUploadRef}
            name='demo[]'
            url='upload'
            multiple
            accept='application/pdf'
            id='upload_docs'
            maxFileSize={1000000}
            onUpload={onTemplateUpload}
            onSelect={onTemplateSelect}
            onError={onTemplateClear}
            onClear={onTemplateClear}
            headerTemplate={headerTemplate}
            itemTemplate={itemTemplate}
            emptyTemplate={emptyTemplate}
            chooseOptions={chooseOptions}
            uploadOptions={uploadOptions}
            cancelOptions={cancelOptions}
        />
    </>
)

I understand why every time we change user or country is over writing to all files when each file dropdown should independent but don’t know how to overcome this issue. Also what is name=”demo[]” what is it exactly? I apologize if I am asking a lot in this post, I’m just a little confused on how to tackle this issue. If the question and/or explanation is not clear please let me know and I’ll try and edit this post. Thanks in advance.

Puppeteer is opening facebook as mobile “size”

Hello today I try to run a old script, I had on my old Linux PC ( arch ) but this time I’m running the script from my iMac 24″, but when the browser is triggered Facebook is re-directing me to their mobile app ( m.facebook.com ).


const browser = await puppeteer.launch({
  headless: false,
  args: ["--window-size=1920,1080"],
  executablePath: "My Path",
});

I don’t remember the last version when I was running my script in arch.

Keys:

  1. Using my custom Chromium path
  2. Version of Puppeteer Core ( 19.3.0 )

I tried with Chrome Path and I got the same issue.
I expected to open Facebook as regular instance ( web view ).
I can’t open Facebook as regular view.