October 22, 2024
Chicago 12, Melborne City, USA
javascript

Why is window not defined in NextJs 14 useEffect?

I’m having a hard time not seeing this simply as a NextJS bug and want to hear what others think. Let’s assume that "myFunction" is a third party script loaded in at the top level app/layout file. I’ve checked in browser console that indeed it loads in correctly. If I place window?.myFunction in as a

Read More
javascript

Vercel Auto redirect error after deployment

so i have this application made with next js 14 that i deployed on vercel but i’m facing a problem that i can’t understand from where it comes , the build went well and everything works greate without any error when i use vercel random generated websites but once i enter to the same project

Read More
javascript

Amplify Federated Signin Documentation for Amplify Gen 2?

The Amplify Gen 2 documentation for Federated Signin is "Shorter" than the Generation 1 documentation. Does anyone know whether there is a setup guide for Federated Signin included with the Amplify Gen 2 documentation that is similar in detail to the Gen 1 documentation? You need to sign in to view this answers

Read More
javascript

Astro.js: Accessing the Astro global object in MDX pages

I have a TypeScript library that, under given conditions, should redirect to an error page. One way would be using the internal Astro global object, like with Astro.redirect('/404'). Unfortunately, Astro seems not accessible when rendering MDX pages. Here is a MWE, where, for simplicity, I am using Astro.url. foo.mdx: --- layout: ./foolayout.astro --- hello foolayout.astro:

Read More
javascript

React Module not found error when importing addColor component

I’m working on a React project for a university assignment and I’m encountering an error when trying to import the addColor component. Here’s the error message I’m getting: (modified to include complete error message) Failed to compile. Module not found: Error: Can't resolve './components/addColor' in '/my/base/path/my-app/src' ERROR in ./src/App.js 8:0-45 Module not found: Error: Can't

Read More
javascript

Coverage in tab network

i was reading about coverage metrics and how can i use it for optimizing my Next or React application by reducing the unused bytes.i think when i wanna start recording the coverage i should start the instrument coverage after loading my page not before loading, and as i understand i should like try to record

Read More
javascript

How do I externally reset the state of a controlled downshift component

I have a downshift typeahead component that allows a user to select options from a dropdown that will autocomplete the rest of the fields in the form using react-final-form. If the user input is not present in the pre-existing mortgagees, there will be an option to create a new object and enter a sort of

Read More
javascript

Power BI JS API – difference between Slicer / Page Slicer / Filter / Page Filter / Visual Filter?

I am new to Powerbi and working on a website and successfully integrates the Powerbi using the embed-token and JavaScript API found at the Powerbi Playground. Following are the steps, how I integrate Powerbi and how end user interacts: Customer already authorized by his Powerbi account, so I have the bearer access token and refresh

Read More
javascript

How to wait for function call in Javascript without calling it directly

you can use Promises. In your case, you can modify your First and Second functions to return Promises. This way, you can await the completion of Second without having to call it directly. like this function First() { console.log('First is called'); return new Promise(resolve => { setTimeout(() => { Second(); resolve(); // Resolve the promise

Read More
javascript

zxing-js refuses to scan barcodes

@model Pocos.MCD_Stores @{ ViewBag.Title = "DoVisit"; } Records Loaded: 0 Do Visit Start Scanner Scan it now! Reset Scanned Barcode: None Product Details: None Select a product { codeReader.listVideoInputDevices() .then(videoInputDevices => { selectedDeviceId = videoInputDevices.deviceId; codeReader.decodeFromVideoDevice(selectedDeviceId, 'barcode-scanner', { formats: [ZXing.BarcodeFormat.EAN_13] }, (result, err) => { if (result) { console.log('Barcode detected:', result); document.getElementById('scannedBarcodeLabel').innerText = `Scanned Barcode:

Read More