Freezing of the interface when using the “jszip” library in a React Native (Expo) project

import JSZip from "jszip";

const createArchive = async() => {
    // Some code
    const zip = new JSZip();
    const data = getExampleData();
    zip.file("example.json", data);
    const zipContent = await zip.generateAsync(
        { type: "base64" },
        (metadata) => {
          setCreationProgress(metadata.percent); // Set a progress value for ui
          console.log("Value:", metadata.percent);
        }
      );// When this function is executed the ui freezes
    // Some code
}

I create an zip archive in this code. It actually works, but when the function “zip.generateAsync()” is executed, the app freezes until the function completes. This can take a long time depending on the size of the files. The interface does not update, and nothing can be clicked. So, the problem is that the user cannot see the progress of the archive creation or cancel it because the interface is unresponsive.
(Also, keep in mind that I’m using Expo).

I believe one solution could be to move the task from the main thread to the background using the ‘expo-task-manager’ and ‘expo-background-fetch’ libraries, but I haven’t been able to make it work yet. Alternatively, I could use another library for creating the archive, but I don’t know which one, as nothing else seems to work with Expo.

How to prevent the default hover effect in NavigationMenuTrigger in vue.js?

I am new to using vue.js
I’m using this component <NavigationMenuTrigger/> from ‘radix-vue’

basically when i hover on the menu it triggers and open it.. and when it’s opened if i hover outside it closes it.

I want to disable both the trigger on hover the click outside/ hover outside.

i tried this

const disabled = true;


const forwardedProps = useForwardProps(delegatedProps)
</script>

<template>
  <NavigationMenuTrigger
  :disableHoverTrigger = "disabled"
  :disableOutsidePointerEvents = "disabled"


    v-bind="forwardedProps"
    :class="cn(navigationMenuTriggerStyle(), 'group', props.class)"
  >
    <slot />
    <ChevronDown
      class="relative top-px ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
      aria-hidden="true"
    />
  </NavigationMenuTrigger>
</template>

but for some reason, it doesn’t work

Can I hide an async function behind a getter in JavaScript? [closed]

Consider the following example:

class Foo {
  #bar
  get bar () { return this.#bar || this.getBar()}
  async getBar () {
    const res = await fetch('https://stackoverflow.com')
    return res
  }
}

const myFoo = new Foo()
const v = await myFoo.bar

As you can see, the bar property will return either a value or a promise based on the private variable it hides. Is it acceptable to use await on a getter in this manner?

I tried to implement an async getter directly, but it does not seem to support async-await syntax.

How to Make Table Headers Sticky on Horizontal Scrolling?

I’m working on a layout where I need the header of a horizontally scrollable middle table to remain sticky at the top while scrolling vertically. The headers for the left and right tables stick just fine, but I’m having trouble with the middle table’s header (probably due to its horizontal scroll).

https://codepen.io/Reynaldo-Rodriguez-the-sasster/pen/XWLqRxo

.container {
  position: relative;
  display: flex;
}

table th {
  position: sticky;
  top: 0;
  background: white;
}

.table-center {
  overflow-x: scroll;
}

table,
th,
td {
  border: 1px solid black;
}

th,
td {
  padding: .5em 1em;
  white-space: nowrap;
}

::-webkit-scrollbar {
  -webkit-appearance: none;
  background-color: transparent;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background-color: rgb(121 121 121);
  box-shadow: none;
}

::-webkit-scrollbar-track {
  background-color: white;
  border: none;
}
<div class="container">
  <div class="table-left">
    <table>
      <tr>
        <th>RIDER #</th>
        <th>RIDER NAME</th>
      </tr>
      <tr>
        <td>#322</td>
        <td>Chase Lanes</td>
      </tr>
      <tr>
        <td>#87</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#567</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#143</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#322</td>
        <td>Chase Lanes</td>
      </tr>
      <tr>
        <td>#87</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#567</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#143</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#322</td>
        <td>Chase Lanes</td>
      </tr>
      <tr>
        <td>#87</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#567</td>
        <td>Marshall Holbrook</td>
      </tr>
      <tr>
        <td>#143</td>
        <td>Marshall Holbrook</td>
      </tr>
    </table>
  </div>
  <div class="table-center">
    <table>
      <tr>
        <th>Lap 1</th>
        <th>Lap 2</th>
        <th>Lap 3</th>
        <th>Lap 4</th>
        <th>Lap 5</th>
        <th>Lap 6</th>
        <th>Lap 7</th>
        <th>Lap 8</th>
        <th>Lap 9</th>
        <th>Lap 10</th>
        <th>Lap 11</th>
        <th>Lap 12</th>
        <th>Lap 13</th>
        <th>Lap 14</th>
        <th>Lap 15</th>
        <th>Lap 16</th>
        <th>Lap 17</th>
        <th>Lap 18</th>
        <th>Lap 19</th>
        <th>Lap 20</th>
        <th>Lap 21</th>
        <th>Lap 22</th>
        <th>Lap 23</th>
        <th>Lap 24</th>
        <th>Lap 25</th>
        <th>Lap 26</th>
        <th>Lap 27</th>
        <th>Lap 28</th>
        <th>Lap 29</th>
        <th>Lap 30</th>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
      <tr>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>00:02.826</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
        <td>--:---:--</td>
      </tr>
    </table>
  </div>
  <div class="table-right">
    <table>
      <tr>
        <th>FASTEST LAP</th>
        <th>AVG LAP</th>
        <th>OVERALL TIME</th>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
      <tr>
        <td>00:00</td>
        <td>00:00</td>
        <td>00:00</td>
      </tr>
    </table>
  </div>
</div>

React useEffect cleanup/unmount function containing stale state

I have some state in my react component, which, upon unmount, I would like to perform some save logic with. I am facing an issue where the state being used on unmount in the useEffect cleanup function is stale because the closure is stale.

When the component unmounts, the state value in the cleanup function is stale.

    const [state, setState] = useState(0)
    useEffect(() => {
        return () => {
            if (state) {
                doSomethingWithState(state); // state never exists or is stale
            }
        };
    }, []);

I have attempted to wrap the cleanup function in a useCallback with a dependency array which includes the state. I have tried putting localState in a useRef and referred to that in the handleUnmount function, but neither of the above work. I have also tried to create a ref for the state value, which is updated on every render to the newest state value, to be used in the cleanup function (useRef supposedly keeps the most recent value), but this doesn’t work either. This was the solution for this question, but did not work for me. The ref never contains a value.

    const [state, setState] = useState(0)
    const stateRef = useRef(state);
    stateRef.current = state;

    useEffect(() => {
        return () => {
            if (stateRef.current) {
                doSomethingWithState(stateRef.current);
            }
        };
    }, []);

Furthermore, if I include anything in the dependency array of the useEffect, then the cleanup function will run every time that value changes, instead of only on unmount, which is less than desirable behaviour. How can I resolve this issue?

javascript scandir ENOENT error (discord.js)

I have a problem with this code

// Función para obtener los nombres de los comandos desde los archivos JavaScript en una carpeta
function getCommandNames(folderPath) {
    const commandFiles = fs.readdirSync(folderPath).filter(file => file.endsWith('.js'));
    return commandFiles.map(file => path.basename(file, '.js'));
}

// Rutas de las carpetas de comandos
const protectionCommands = getCommandNames("../proteccion");
const moderationCommands = getCommandNames("../moderacion");
const configurationCommands = getCommandNames("../configuracion");
const otherCommands = getCommandNames("../otros");

always sent
errno: -2,
syscall: ‘scandir’,
code: ‘ENOENT’,
path: ‘../proteccion’ (and with moderacion, otros and configuracion)
and I try change the path, but nothing, the same error.

my workspace:
index
comandos

  • otros
    • comandos.js (the currently file)
  • configuracion
  • moderacion
  • proteccion

Anyone can help me? ty

I have an error with javascript scandir (path) and I need help to solve it.

Fetch Base Query Not Updating After Code Changes and File Missing in node_modules

i have been dealing with fetchBaseQuery error from past few days after checking the network i found problem in fetch base query after i corrected it in the project but it is not getting corrected in the console after running repeated times also the file is not showing in the but is present in the modules and hidden somehow in the path

enter image description here image of project code at vs
enter image description here image of code at console

i tried various methods but none worked is it something related to localhost as server and client are running on different but i did use cors as to enable sharing data

using WordPress’s apiFetch with react returns same value every time

so I have select and content container, when select changes there goes apiFetch with selected ID to get data from post with that ID, props.attributes.theId changes correctly but response from every apiFetch is just one last post every time, what could be the problem?

const [thePreview, setThePreview] = useState("")
    
      useEffect(() => {
        async function go() {  
          alert(props.attributes.theId);
          const response = await apiFetch({
            path: `/thePlugin/v1/getHTML?theId=${props.attributes.theId}`,
            method: "GET"
          })      
          setThePreview(response)
        }
        go()
    
      }, [props.attributes.theId])

evelopment.ERROR: Class “Ledger” not found {“exception”:”[object] (Error(code: 0): Class “Ledger” not found at

development.ERROR: Class “Ledger” not found {“exception”:”[object] (Error(code: 0): Class “Ledger” not found at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php:750)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php(81): IlluminateDatabaseEloquentModel->newRelatedInstance()
#1 /var/www/html/app/Models/Provider.php(346): IlluminateDatabaseEloquentModel->hasOne()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(539): Provider->ledger()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(491): IlluminateDatabaseEloquentModel->getRelationshipFromMethod()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(440): IlluminateDatabaseEloquentModel->getRelationValue()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2030): IlluminateDatabaseEloquentModel->getAttribute()
#6 /var/www/html/app/Models/Provider.php(1601): IlluminateDatabaseEloquentModel->__get()
#7 /var/www/html/app/Models/Provider.php(1638): Provider->createLedger()
#8 /var/www/html/app/Http/Controllers/ProviderWizardController.php(2088): Provider->updateParentLedger()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): ProviderWizardController->validateDocsAndSaveAll()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): IlluminateRoutingController->callAction()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): IlluminateRoutingControllerDispatcher->dispatch()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): IlluminateRoutingRoute->runController()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(721): IlluminateRoutingRoute->run()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): IlluminateRoutingRouter->IlluminateRouting{closure}()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(723): IlluminatePipelinePipeline->then()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(698): IlluminateRoutingRouter->runRouteWithinStack()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): IlluminateRoutingRouter->runRoute()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(651): IlluminateRoutingRouter->dispatchToRoute()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): IlluminateRoutingRouter->dispatch()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): IlluminateFoundationHttpKernel->IlluminateFoundationHttp{closure}()
#22 /var/www/html/app/Http/Middleware/LocaleMiddleware.php(29): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): AppHttpMiddlewareLocaleMiddleware->handle()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): IlluminateViewMiddlewareShareErrorsFromSession->handle()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): IlluminateSessionMiddlewareStartSession->handleStatefulRequest()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): IlluminateSessionMiddlewareStartSession->handle()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): IlluminateCookieMiddlewareAddQueuedCookiesToResponse->handle()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): IlluminateCookieMiddlewareEncryptCookies->handle()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): IlluminateFoundationHttpMiddlewarePreventRequestsDuringMaintenance->handle()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): IlluminatePipelinePipeline->IlluminatePipeline{closure}()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): IlluminatePipelinePipeline->then()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): IlluminateFoundationHttpKernel->sendRequestThroughRouter()
#38 /var/www/html/public/index.php(52): IlluminateFoundationHttpKernel->handle()

Guys When I try retiter user on ap show this error.

NOVO

11h16
Durante o cadastro retorna esse erro

On web applications show this erro onn try registrer user.

Block Web Audio API in JS

I have problem with this notification when I play my game HTML5 made with construct 3 in android browser . When the game starts, the sounds play in the background even when I exit the browser. I tried this code :

  //
GoToLayout(layout) {
    if (this._runtime.IsLoading()) return;
    const layoutManager = this._runtime.GetLayoutManager();
    if (layoutManager.IsPendingChangeMainLayout()) return;
    
    // Audio notification blocking script
    (function() {
        // Store the original AudioContext
        const OriginalAudioContext = window.AudioContext || window.webkitAudioContext;
        
        // Override AudioContext to add custom behavior
        window.AudioContext = window.webkitAudioContext = function(...args) {
            const audioContext = new OriginalAudioContext(...args);
            
            // Override the close method
            const originalClose = audioContext.close;
            audioContext.close = function() {
                originalClose.call(this);
                // Additional cleanup to ensure no background audio
                this.destination.disconnect();
            };
            
            // Add an event listener for visibility change
            document.addEventListener('visibilitychange', function() {
                if (document.hidden) {
                    audioContext.suspend();
                } else {
                    audioContext.resume();
                }
            });
            
            return audioContext;
        };
        
        // Attempt to disable notifications
        if ('Notification' in window) {
            Notification.requestPermission().then(function(permission) {
                if (permission === 'granted') {
                    // Override the Notification constructor to block audio notifications
                    const OriginalNotification = window.Notification;
                    window.Notification = function(title, options) {
                        if (options && options.silent === undefined) {
                            options.silent = true;
                        }
                        return new OriginalNotification(title, options);
                    };
                    window.Notification.requestPermission = OriginalNotification.requestPermission;
                }
            });
        }
    })();
    
    // Proceed with changing the layout
    layoutManager.ChangeMainLayout(layout);
},

But it doesn’t work. I want a way to prevent this notification from appearing.

But it doesn’t work. I want a way to prevent this notification from appearing.

Calculating days, hours and minutes from strings [closed]

I have for example array of strings

[
 '64 days 6 hours 30 minutes',
 '1 day 23 hours 30 minutes',
 '1 day',
 '10 minutes'
]

I need to write a javascript function returning a string which is a sum of days hours minutes like that:

'67 days 6 hours 10 minutes'

I’m happy to use third-party library as far as it’s npm.

Honestly, I have no clue where to start, researched everything I could research…

I want to create a timer for a game that I can reset. If I lift the state of the timer to the parent, the game becomes unresponsive

I am currently building a timer component to time how long players take to finish a game from the moment the website loads. If I lift the state of the timer to the parent component, the entire app re-renders every second, rendering my game unresponsive. However I wish to be able to reset the timer from my parent component.

I have moved the state to it’s own component which means that my app isn’t constantly re-rendering, however I am struggling with allowing my parent component reset the timer in my child timer component.

Here is my Timer component – resetTime and setResetTime are a state in the parent component

import { useEffect, useState } from "react";

export default function Timer({
    characters,
    guessed,
    resetTime,
    setResetTime,
}) {
    const initialTime = 0;

    const [runningTime, setRunningTime] = useState(initialTime);

    if (resetTime === true) {
        setRunningTime(initialTime);
        setResetTime(false);
    }

    useEffect(() => {
        const key = setInterval(() => {
            if (guessed.length < characters.length) {
                setRunningTime((runningTime) => runningTime + 1);
            } else {
                clearInterval(key);
            }
        }, 1000);

        return () => {
            clearInterval(key);
        };
    }, [characters.length, guessed.length]);

    return <h4>{`${runningTime}`}</h4>;
}

And in my parent component I have a button that uses the resetGame() function onClick

    function resetGame() {
        handleClose();
        setGuess(initialGuess);
        setGuessed(initialGuessed);
        setResetTime(true);
    }
<button onClick={resetGame}>Reset Game</button>

This works to reset the timer, however it pops lots of errors in the console about too many re-renders whenever I click it. Further if I click on the reset timer button during the one second interval, it says that I cannot re-render the parent component while a child component is re-rendering, making my button occasionally unresponsive.

Fade out Text 1, Fade in Text 2, Fade out Text 2, Fade in Text 3, Fade out Text 3, Fade in Text 1 [closed]

I am a self study student learning to code and I have hit a wall on my current project.
I am trying to make a Customer Quotes section on a page that sorts two sections of text through their own set of three different texts. For example, Quote 1 by Customer 1 fades out and fades in Quote 2 by Customer 2. Repeat for Quote 3 by Customer 3 until you start again with Quote 1 by Customer 1.

Each loop of fading in and out should take up to 10 seconds to complete its transtion.
The fading of the two sets of text should be synced.

Most likly I am experinceing a knowledge gap when it comes to Javascript to make this happen.
The project is limited to HTML, CSS, and Javascript.

The current CSS I have puts the quote in a box and postions the three rows of text within the box. The first row is on the top left. Second row is in the center. Third row is on the bottom right of the box.

My apologies for not post what code I do have. First time posting and I could not figure out Stack OverFlow’s posting rules for showing code.