How to Disabled the future date?

This is the my HTML code for select Yes or No

<div class="rdio rdio-primary  custom-control-inline">
    @Html.RadioButtonFor(m => m.IsTakenETAAptitude, true, new { id = "IsTakenETAAptitudeYes" })
    <label for="IsTakenETAAptitudeYes">Yes</label>
</div>
<div class="rdio rdio-primary  custom-control-inline">
    @Html.RadioButtonFor(m => m.IsTakenETAAptitude, false, new { id = "IsTakenETAAptitudeNo" })
    <label for="IsTakenETAAptitudeNo">No</label>
</div>

If I select the Yes at that time i show this code for select the date from the datepicker

<div class="form-group directentryQustions">
    @Html.DropDownListFor(m => m.ETAAptitudeType, new SelectList(TempData["ETAAptitudeTestType"] as System.Collections.IEnumerable, "Value", "Text"), "Select", new { id = "ETAAptitudeTestType", @class = "selectpicker form-control" })
</div>

At the same time when i select the Yes js code also hit the js code is below:

$("#IsTakenETAAptitudeYes").on('click', function () {
    $("#ETAAptitudeTestDetails").show();
    $("#ETAAptitudeTestType").prop("selectedIndex", 0);
    $("#ETAAptitudeTestType").change();
    $("#ETAAptitudeTestType").val('');
    $("#aptitudeTestDate").val('');
});

I tried this code for disabled the Future date but this code is not working.

$("#aptitudeTestDate").datepicker({
    maxDate: 0, // Disable future dates
    dateFormat: 'mm/dd/yy' // Adjust the date format as needed
});

Module Federation on a Vue with Vite gets Uncaught SyntaxError: Cannot use ‘import.meta’ outside a module

How can I resolve the error Uncaught SyntaxError: Cannot use ‘import.meta’ outside a module when consuming a remote Vue 3 app (built with Vite and Module Federation) in a host application using Vue 3 and Vue CLI?

Context:
I have a Vue 3 remote app built with Vite using Module Federation. It is exposed as a remote and works as expected when running locally. However, when I try to consume this remote app in my host application (built using Vue CLI), I encounter the following error in the browser console:

Uncaught SyntaxError: Cannot use 'import.meta' outside a module

The remote app is built using Vite and exposes modules via Module Federation.
The host app is built with Vue CLI, using webpack as its bundler.
I’ve configured the federation plugin in both the remote and host apps.

What I’ve Tried:
Verified that the vite.config.js for the remote app has build.target set to esnext.

Question:
How can I ensure compatibility between the Vite-built remote app and the Vue CLI host app when using Module Federation?
Is there a way to handle the import.meta issue during the build process for Vite, or does the Vue CLI host app require additional configuration to support this?
Any guidance on resolving this issue or debugging tips would be greatly appreciated!

Chrome Extension: Placeholder Text Issue with XPath and ContentEditable

I’m studying how to build an extension for Google Chrome, and my first project is to automatically send messages to a list of my clients via WhatsApp Web. I’m trying to accomplish this by getting the search box element using its XPath and inserting the contact information. However, I’ve encountered some challenges. Here’s the code I’m using:

const waitTimeout = (ms) => new Promise(resolve => setTimeout(resolve, ms));

const typeInTextBox = async (selector, number) => {

let el = document.evaluate(selector,
  document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

for (var i = 0; i < 5; i++) {
  el.focus();
  document.execCommand('selectAll');
  document.execCommand('insertText', false, number);
  el.dispatchEvent(new Event('change', {bubbles: true})); 
  el.blur();
  await waitTimeout(2000);

  if (el.textContent == number) {
    return true;
  }
}
return false;
}

await typeInTextBox('/html/body/div[1]/div/div/div[3]/div/div[2]/div[1]/span/div/span/div/div[1]/div[2]/div[2]/div/div', 'Hello World')

As can be seen from the image below, the code works partially. The contact information gets inserted into the search box, but the placeholder text does not disappear, and nothing happens.

enter image description here

It seems that the placeholder text disappears only when the search box is clicked, but this issue doesn’t get resolved even by calling the click or focus function. Would there be some workaround for this?

The element retrieved by using the XPath is contenteditable attribute.

how to import typescript file in javascript file

I have a Node.js(Node 16) server project that write by javascript and CJS import style, then I want to migrate this project to typescript. what I want is the legacy file using javascript, and the new file writen by typescript. and migratet the legacy javascript to typescript step by step. This is the typescript file look like:

import { DocumentOptions, MeiliSearch } from 'meilisearch';
import log4js from "log4js";
var logger = log4js.getLogger()
logger.level = 'warn'

export const updateFullsearch = async (file: any) => {
    try {
        const masterKey = process.env.MEILI_MASTER_KEY
        let option: DocumentOptions = {
            primaryKey: 'file_id',
        }
        const client = new MeiliSearch({
            host: 'http://meilisearch.reddwarf-toolbox.svc.cluster.local:7700',
            apiKey: masterKey
        })
        let clientIdx = client.index('files')
        clientIdx.addDocuments([file], option)
            .then((res: any) => { })
        clientIdx.updateFilterableAttributes(["name", "project_id"])
    } catch (err) {
        logger.error('Failed to sync file index', err)
    }
}

how to import this typescript file in javascript? is it possible? or I have migrate the whole project at the same time? I have tried to import like this:

const updateFullsearch = require('./tex/fulltext_search').updateFullsearch

but shows could not load module │ Error: Cannot find module './tex/fulltext_search'. is it possible to solve this issue? I am compile project like this:

"scripts": {
    "start": "node ./bin/server-express.js",
    "dist": "rm -rf dist && rollup -c && tsc",
    "lint": "standard && tsc",
  },
 

and run npm dist command.

Issue with redis client geoSearch

So I am facing this issue when trying to use the redis client geoSearch. I am trying to query my stored drivers which I have previously added with the geoAdd command. After adding I have been able to successfully make a search. I am trying to then alter the code to include the distance of the returned drivers to where exactly the query was made from, but I am running into a type error.

const fetchOnlineDriversWithDistance = async () => {
  try {
    const drivers = await redisService.client.geoSearch(
      "online:drivers",
      { longitude: -122.27652, latitude: 37.805186 },
      { radius: 5, unit: "km" },
      { WITHDIST: true } // Additional options
    );
    console.log(drivers);
  } catch (error) {
    console.error("Error fetching drivers with distance:", error);
  }
};

The error message typescript is throwing:
Argument of type ‘[“online:drivers”, { longitude: number; latitude: number; }, { radius: number; unit: “km”; }, { WITHDIST: boolean; }]’ is not assignable to parameter of type ‘[key: RedisCommandArgument, from: GeoSearchFrom, by: GeoSearchBy, options?: GeoSearchOptions] | [options: CommandOptions, key: RedisCommandArgument, from: GeoSearchFrom, by: GeoSearchBy, options?: GeoSearchOptions]’.
Type ‘[“online:drivers”, { longitude: number; latitude: number; }, { radius: number; unit: “km”; }, { WITHDIST: boolean; }]’ is not assignable to type ‘[options: CommandOptions, key: RedisCommandArgument, from: GeoSearchFrom, by: GeoSearchBy, options?: GeoSearchOptions]’.
Type at position 0 in source is not compatible with type at position 0 in target.
Type ‘string’ is not assignable to type ‘CommandOptions’.
Type ‘string’ is not assignable to type ‘{ readonly [symbol]: true; }’.ts(2345)

I tried to make my way into the types specified by redis to see if I could get an Idea of what was expected. I am thinking of trying to use something like geoRadius maybe that would work. Geosearch is however the recommended to use by redis

React Native IAP: getSubscriptions Returns Empty Array on iOS

I’m using the react-native-iap library to handle in-app subscriptions in my React Native app. While testing on iOS, the getSubscriptions method is returning an empty array, even though the subscriptions are correctly configured in App Store Connect.

Here’s my code

import RNIap, { initConnection, getSubscriptions } from 'react-native-iap';
const productIds = ['pro_monthly_us']; // Example product IDs
useEffect(() => {
  const initializeIAP = async () => {
    try {
      const connection = await initConnection();
      console.log('IAP Connection:', connection);
      const subscriptions = await getSubscriptions({"skus":productIds});
      console.log('Subscriptions:', subscriptions); // Returns empty array
    } catch (error) {
      console.error('IAP Initialization Error:', error);
    }
  };
  initializeIAP();
  return () => {
    RNIap.endConnection();
  };
}, []);

peerConnection.onicecandidate callback not being called (webRTC, Angular)

I am a beginer trying to make a webRTC videocall app as a project (I managed to get it to work with websockets, but on slow internet is freezes). I am using Angular for FE and Go for BE. I have an issue with the peerConnection.onicecandidate callback not firing. The setLocalDescription and setRemoteDescription methods seem to not throw any errors, and logging the SDPs looks fine so the issue is not likely to be on the backend, as the SDP offers and answers get transported properly (via websockets). Here is the angular service code that should do the connectivity:

import { HttpClient, HttpHeaders } from '@angular/common/http'
import { Injectable, OnInit } from '@angular/core'
import { from, lastValueFrom, Observable } from 'rxjs'
import { Router } from '@angular/router';

interface Member {
memberID: string
name: string
conn: RTCPeerConnection | null
}

@Injectable({
providedIn: 'root'
})
export class ApiService {

    constructor(private http: HttpClient, private router: Router) { }
    
    // members data
    public stableMembers: Member[] = []
    
    // private httpUrl = 'https://callgo-server-386137910114.europe-west1.run.app'
    // private webSocketUrl = 'wss://callgo-server-386137910114.europe-west1.run.app/ws'
    private httpUrl = 'http://localhost:8080'
    private webSocketUrl = 'http://localhost:8080/ws'
    
    // http
    createSession(): Promise<any> {
        return lastValueFrom(this.http.post(`${this.httpUrl}/initialize`, null))
    }
    
    kickSession(sessionID: string, memberID: string, password: string): Promise<any> {
        return lastValueFrom(this.http.post(`${this.httpUrl}/disconnect`, {
            "sessionID":`${sessionID}`,
            "memberID":`${memberID}`,
            "password":`${password}`
        }))
    }
    
    // websocket
    private webSocket!: WebSocket
    
    // stun server
    private config = {iceServers: [{ urls: ['stun:stun.l.google.com:19302', 'stun:stun2.1.google.com:19302'] }]}
    
    // callbacks that other classes can define using their context, but apiService calls them
    public initMemberDisplay = (newMember: Member) => {}
    public initMemberCamera = (newMember: Member) => {}
    
    async connect(sessionID: string, displayName: string) {
        console.log(sessionID)
    
        this.webSocket = new WebSocket(`${this.webSocketUrl}?sessionID=${sessionID}&displayName=${displayName}`)
    
        this.webSocket.onopen = (event: Event) => {
            console.log('WebSocket connection established')
        }
    
        this.webSocket.onmessage = async (message: MessageEvent) => {
            const data = JSON.parse(message.data)
            
            // when being asigned an ID
            if(data.type == "assignID") {
                sessionStorage.setItem("myID", data.memberID)
                this.stableMembers.push({
                    "name": data.memberName,
                    "memberID": data.memberID,
                    "conn": null
                })
            } 
    
            // when being notified about who is already in the meeting (on meeting join)
            if(data.type == "exist") {
                this.stableMembers.push({
                    "name": data.memberName,
                    "memberID": data.memberID,
                    "conn": null
                })
            }
    
            // when being notified about a new joining member
            if(data.type == "join") {
                // webRTC
                const peerConnection = new RTCPeerConnection(this.config)
                // send ICE
                peerConnection.onicecandidate = (event: RTCPeerConnectionIceEvent) => {
                    console.log(event)
                    event.candidate && console.log(event.candidate)
                }
                // send SDP
                try {
                    await peerConnection.setLocalDescription(await peerConnection.createOffer())
                    this.sendSDP(peerConnection.localDescription!, data.memberID, sessionStorage.getItem("myID")!)
                } catch(error) {
                    console.log(error)
                }
    
                this.stableMembers.push({
                    "name": data.memberName,
                    "memberID": data.memberID,
                    "conn": peerConnection
                })
            }
    
            // on member disconnect notification
            if(data.type == "leave") {
                this.stableMembers = this.stableMembers.filter(member => member.memberID != data.memberID)
            }
    
            // on received SDP
            if(data.sdp) {
                if(data.sdp.type == "offer") {
                    const peerConnection = new RTCPeerConnection(this.config)
                    try {
                        const findWithSameID = this.stableMembers.find(member => member?.memberID == data?.from)
                        findWithSameID!.conn = peerConnection
                        await peerConnection.setRemoteDescription(new RTCSessionDescription(data.sdp))
                        const answer: RTCSessionDescriptionInit = await peerConnection.createAnswer()
                        await peerConnection.setLocalDescription(answer)
                        this.sendSDP(answer, data.from, sessionStorage.getItem("myID")!)
    
                        this.initMemberDisplay(findWithSameID!)
                        this.initMemberCamera(findWithSameID!)
                    } catch(error) {
                        console.log(error)
                    }
                }
    
                if(data.sdp.type == "answer") {
                    try {
                        const findWithSameID = this.stableMembers.find(member => member?.memberID == data?.from)
                        await findWithSameID!.conn!.setRemoteDescription(new RTCSessionDescription(data.sdp))
    
                        this.initMemberDisplay(findWithSameID!)
                        this.initMemberCamera(findWithSameID!)
                    } catch(error) {
                        console.log(error)
                    }
                }
            }
        }
    
        this.webSocket.onclose = () => {
            console.log('WebSocket connection closed')
            this.stableMembers = []
            this.router.navigate(['/menu'])
        }
    
        this.webSocket.onerror = (error) => {
            console.error('WebSocket error:', error)
        }
    }   
    
    close() {
        if(this.webSocket && this.webSocket.readyState === WebSocket.OPEN) {
            this.webSocket.close()
        } else {
            console.error('WebSocket already closed.')
        }
    }
    
    sendSDP(sdp: RTCSessionDescriptionInit, to: string, from: string) {
        this.webSocket.send(JSON.stringify({
            "to": to,
            "from": from,
            "sdp": sdp
        }))
    }

}

As a quick explination, stableMembers holds references to all the members on the client and the rest of the code modifies it as necessary. The callbacks initMemberDisplay and initMemberCamera are supposed to be defined by other components and used to handle receiving and sending video tracks. I haven’t yet implemented anything ICE related on neither FE or BE, but as I tried to, I noticed the onicecandidate callback simply won’t be called. I am using the free known stun google servers: private config = {iceServers: [{ urls: [‘stun:stun.l.google.com:19302’, ‘stun:stun2.1.google.com:19302’] }]}. In case you want to read the rest of the code, the repo is here: https://github.com/HoriaBosoanca/callgo-client . It has a link to the BE code in the readme.

I tried logging the event from the peerConnection.onicecandidate = (event: RTCPeerConnectionIceEvent) => {console.log(event)} callback and I noticed nothing was logged.

React useReducer state not updating correctly

I am facing a challenge in React where I need to upload a bunch of images one after another. For this, I made a sort of a queue in which as the user selects the image it is added to the queue and the queue processes it by uploading the image to s3 and returns the uploaded URL and updated status here is the code for this:

import { uploadToS3 } from '~/utils/s3Upload';
import { PPFInspectionImage } from '~/context/PPFInspectionContext';

type StatusCallback = (
  status: PPFInspectionImage['uploadStatus'],
  serverUrl?: string,
  key?: string
) => void;

interface QueueItem {
  image: PPFInspectionImage;
  partId: number;
  onStatusChange: StatusCallback;
}

export class UploadManager {
  private static instance: UploadManager;
  private uploadQueue: QueueItem[] = [];
  private isProcessing = false;
  private maxConcurrent = 2;
  private token: string;

  private constructor(token: string) {
    this.token = token;
  }

  static getInstance(token: string): UploadManager {
    if (!UploadManager.instance || UploadManager.instance.token !== token) {
      UploadManager.instance = new UploadManager(token);
    }
    return UploadManager.instance;
  }

  addToQueue(image: PPFInspectionImage, partId: number, onStatusChange: StatusCallback) {
    this.uploadQueue.push({ image, partId, onStatusChange });
    this.processQueue();
  }

  private async processQueue() {
    if (this.isProcessing) return;
    this.isProcessing = true;

    try {
      while (this.uploadQueue.length > 0) {
        const batch = this.uploadQueue.splice(0, this.maxConcurrent);
        await Promise.all(batch.map((item) => this.uploadImage(item)));
      }
    } catch (error) {
      console.error('Error processing queue:', error);
    } finally {
      this.isProcessing = false;
    }
  }

  private async uploadImage({ image, partId, onStatusChange }: QueueItem) {
    onStatusChange('uploading');

    try {
      const response = await uploadToS3({
        uri: image.localUri,
        token: this.token,
        inspectionType: 'ppf',
      });

      const serverUrl = `https://${process.env.EXPO_PUBLIC_BUCKET_NAME}.s3.${process.env.EXPO_PUBLIC_BUCKET_REGION}.amazonaws.com/${process.env.EXPO_PUBLIC_PPF_FOLDER}/${response.fileName}`;

      onStatusChange('completed', serverUrl, response.key);
    } catch (error) {
      console.error('Upload failed:', error);
      onStatusChange('failed');

      // Add back to queue if retries remaining
      if ((image.retryCount || 0) < 3) {
        this.uploadQueue.push({
          image: { ...image, retryCount: (image.retryCount || 0) + 1 },
          partId,
          onStatusChange,
        });
      }
    }
  }

  // Method to retry failed uploads
  retryUpload(image: PPFInspectionImage, partId: number, onStatusChange: StatusCallback) {
    this.addToQueue({ ...image, retryCount: 0 }, partId, onStatusChange);
  }
}

now the thing is I want to update the state after this queue is done processing the image for which I have the statusCallback and in that status callback I am calling a useReducer action like this

// Start background upload
        UploadManager.getInstance(token).addToQueue(newImage, partId, (status, serverUrl, key) => {
          dispatch({
            type: 'UPDATE_IMAGE_STATUS',
            payload: { partId, id: newImage.id, status, serverUrl, key },
          });
        });

The problem is if I add the images slowly they get processed correctly. The state is also updated correctly but when I quickly add the images one after another the queue processes them and uploads them and returns the correct complete statuses but when the state is updated multiple times, sometimes it does not set up the status correctly which results in one or two images status still being set to uploading or pending but in reality, they are uploaded successfully.
here is my reducer:

case 'UPDATE_IMAGE_STATUS': {
      const part = state.faults[action.payload.partId];
      if (!part) return state;

      return {
        ...state,
        faults: {
          ...state.faults,
          [action.payload.partId]: {
            ...part,
            images: part.images.map((img) =>
              img.id === action.payload.id
                ? {
                    ...img,
                    uploadStatus: action.payload.status,
                    serverUrl: action.payload.serverUrl,
                    key: action.payload.key,
                  }
                : img
            ),
          },
        },
      };
    }

Issue Splitting a Polygon into Two Using LineString with Turf.js

I’m working on a project where I need to split a polygon into two distinct polygons using a LineString. I’m using Turf.js to handle geometric operations like intersection, splitting, and polygonizing. Despite ensuring the input geometries seem correct, the turf.polygonize function fails to generate two valid polygons and only outputs one. Below is the challenge and the code I’ve implemented. Below is the code I’ve implemented so far and the output I am trying to achieve.

Output:
Split a polygon into exactly two valid polygons using a LineString that intersects it.

My Code:

dividePolygon() {    
    try {

      const featureGroup = new L.FeatureGroup(this.layers);
      this.map.addLayer(featureGroup);

      this.selectedPlots.forEach(plot => {
        featureGroup.addLayer(plot);
      });

      const drawControl = new L.Control.Draw({
        edit: {
          featureGroup: featureGroup,
        },
        draw: {
          polyline: {
            shapeOptions: {
              color: 'red',
              weight: 4,
            },
          },
        },
      });

      this.map.addControl(drawControl);

      this.map.on(L.Draw.Event.CREATED, (e: any) => {

        const drawnLineLayer = e.layer as L.Polyline;

        featureGroup.eachLayer((layer: L.Layer) => {
          const plotGeoJSON = (layer as L.Polygon).toGeoJSON() as Feature<Polygon>;
          const drawnLineGeoJSON = drawnLineLayer.toGeoJSON() as Feature<LineString>;

          const intersectionPoints = turf.lineIntersect(drawnLineGeoJSON, plotGeoJSON);

          if (intersectionPoints.features.length > 0) {
            console.log("Original Polygon Coordinates:", plotGeoJSON.geometry.coordinates);
            console.log("Intersection Points: ", intersectionPoints);

            // Slice the line segment inside the polygon
            const slicedLine = turf.lineSlice(
              turf.point(intersectionPoints.features[0].geometry.coordinates),
              turf.point(intersectionPoints.features[1].geometry.coordinates),
              drawnLineGeoJSON
            );

            console.log("Sliced Line Coordinates:", slicedLine);

            const splitPolygons = this.splitPolygonWithLine(plotGeoJSON, slicedLine);

            if (splitPolygons && splitPolygons.length === 2) {

              // Updated polygons on the map
              const newPlot1Layer = L.geoJSON(splitPolygons[0]).addTo(this.map);
              const newPlot2Layer = L.geoJSON(splitPolygons[1]).addTo(this.map);

              // Remove the original polygon from the map
              this.map.removeLayer(layer);
            } else {
              console.error('Error: The polygon was not split into exactly two polygons.');
            }
          }
        });
      });

    } catch (error) {
      console.error('Error while dividing the polygon:', error);
    }
  }


  splitPolygonWithLine(polygon: Feature<Polygon>, line: Feature<LineString>): Feature<Polygon>[] | null {
    if (!turf.booleanIntersects(line, polygon)) {
      console.error("Error: Line does not intersect the polygon.");
      return null;
    }

    try {
      const flippedPolygon = turf.flip(polygon);
      const flippedLine = turf.flip(line);
      const polygonBoundary = turf.polygonToLine(flippedPolygon) as Feature<LineString>;

      // Split the polygon boundary using the slicing line
      const splitLines = turf.lineSplit(polygonBoundary, flippedLine);

      if (splitLines.features.length < 2) {
        console.error("Error: Unable to split the polygon boundary into two parts.");
        return null;
      }

      // Combine split lines with the slicing line to form the full boundary
      const combinedLines = turf.featureCollection([
        ...splitLines.features,
        flippedLine,
      ]);

      const splitPolygons = turf.polygonize(combinedLines);

      // Ensure polygons are closed loops
      splitPolygons.features.forEach(poly => {
        const coords = poly.geometry.coordinates[0];
        if (coords[0][0] !== coords[coords.length - 1][0] ||
          coords[0][1] !== coords[coords.length - 1][1]) {
          coords.push(coords[0]); // Close the loop if necessary
        }
      });

      const validPolygons = splitPolygons.features.filter(poly => {
        const area = turf.area(poly);
        return area > 0 && turf.booleanWithin(turf.centroid(poly), flippedPolygon);
      });

      // Ensure we have exactly two valid polygons
      if (validPolygons.length === 2) {
        return validPolygons.map(poly => turf.flip(poly));
      } else {
        console.error("Error: Did not generate exactly two valid polygons. Found:", validPolygons.length);
        return null;
      }
    } catch (error) {
      console.error("Error during polygon split:", error);
      return null;
    }
  }

Main Issue:

After performing the split and running the turf.polygonize method, I get only one polygon instead of the expected two. The error I encounter is:

Error: Did not generate exactly two valid polygons. Found: 1

Even though the intersection points and split lines seem correct, the final step of combining the lines and polygonizing them doesn’t produce the desired output.

How to change prettier indentation?

errors being thrown
only 6 spaces

Below is the settings I currently have for prettier:

{
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnType": false, // required
    "editor.formatOnPaste": true, // optional
    "editor.formatOnSave": true, // optional
    "editor.formatOnSaveMode": "file", // required to format on save
    "prettier.singleQuote": true,
    "prettier.printWidth": 80,
    "eslint.options": {
        "rules": {
            "quotes": [2, "single"],
            "prettier/prettier": ["error", {"singleQuote": true}]
        }
    },
    "prettier.tabWidth": 2,
    "prettier.bracketSpacing": false,
    "prettier.trailingComma": "all",
    "prettier.useTabs": false
}

Below is the eslint.config.js that is included in my project repository (enforced by the professor, nothing here can change):

import google from 'eslint-config-google';
delete google.rules['valid-jsdoc'];
delete google.rules['require-jsdoc'];

import jsdoc from 'eslint-plugin-jsdoc';
import js from '@eslint/js';
import globals from 'globals';

export default [
  google,
  js.configs.recommended,
  jsdoc.configs['flat/recommended'],
  {
    plugins: {
      jsdoc,
    },
    rules: {
      // "no-unused-vars": "warn",
      // "no-undef": "warn",
    },
    languageOptions: {
      ecmaVersion: 2024,
      sourceType: 'module',
      globals: {
        ...globals.browser,
        ...globals.node,
      },
    },
  },
];

I have already tried changing tabWidth to a different number, however that changes every single indentation, which is not what I need. I have also tried setting “useTabs” to True while also changing tabWidth around, also to no avail. This is for a course, and I have to adhere to the linter rules, which does not allow the use of tabs instead of spaces.

Type ‘{ uuid: string; }’ is missing the following properties from type ‘Promise’

This happens on my NextJS 15 app for some reasons, I can’t figure out what is happening. Dev environment works fine, but when it comes to production:

npm run build

Full Error:

app/checkout/[uuid]/page.tsx
Type error: Type '{ params: { uuid: string; }; }' does not satisfy the constraint 'PageProps'.
  Types of property 'params' are incompatible.
    Type '{ uuid: string; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]

Static worker exited with code: 1 and signal: null

page.tsx:

import CheckoutForm from "@/components/forms/checkout-form";
import { notFound, redirect } from "next/navigation";
import { prisma } from "@/lib/db";
import { Progress } from "@/components/ui/progress";

async function getCheckoutData(uuid: string) {
  const checkoutData = await prisma.checkout.findUnique({
    where: { id: uuid },
    select: {
      id: true,
      title: true,
      status: true,
      currency: true,
    },
  });

  if (!checkoutData) {
    notFound();
  }
  return checkoutData;
}

export default async function CheckoutPage({ params }: { params: { uuid: string } }) {
  const checkoutData = await getCheckoutData(params.uuid);
  if (checkoutData.status === true) {
    redirect('/');
  }
  
  return (
    <div className="mx-auto max-w-7xl px-6 lg:px-8 py-12 flex items-start space-y-6 flex-col w-full sm:w-[400px]">
        <h3 className="text-xl tracking-tight text-pretty line-clamp-2 text-ellipsis overflow-hidden">
          {checkoutData.title}
        </h3>
      <Progress value={50} />
      <CheckoutForm checkoutData={checkoutData} />
      <p className="text-sm text-muted-foreground">Clears instantly 24/7</p>
    </div>
  );
}

I tried adding Promise, defining Props, nothing works.

const { uuid } = await Promise.resolve(params);

Ty !

Use the same SVG filter with different seeds or offsets

In my html page, I have an SVG filter like this:

<filter id="displacementFilter" height="180%" width="180%">
    <feTurbulence
      type="turbulence"
      baseFrequency="0.05"
      numOctaves="2"
      result="turbulence" />
    <feDisplacementMap
      in2="turbulence"
      in="SourceGraphic"
      scale="50"
      xChannelSelector="R"
      yChannelSelector="G" />
  </filter>

In order to make the filtered elements look different, I want to use this same filter with different seeds or offsets for the <feTurbulence> tag. I don’t want to repeat the filter several times since this will significantly increase the size of the page. Is there a solution?

WakeLock is not released on page transition in android [closed]

androidで通話アプリを作成しています。
chromeブラウザでPWAで動作するアプリです。
通話中はsleepに入らないようにWake Lockを設定しています。
通話中に別のページに遷移させられることがあるのでページ遷移時にWake Lockを解除したいが解除されずページ遷移後もWake Lockされたい状態になります。
Wake Lock解除方法に間違いがありますか?

・vue2を使っています
・VueUseのuseWakeLockを使ってWake Lockを制御しています

コンポーネントのsetup時にWake Lockを取得します

    setup() {
        const wakeLock = useWakeLock()

        return {
            wakeLock,
        }
    },

mouted時にWake Lockを設定し、インスタンスをwindowに保持します

    mounted() {
        this.wakeLock.request('screen');
        window.wakeLockInstance = this.wakeLock;
    },

通常の通話終了時はbeforeDestroyでWake Lockを解除しており、これは正常にWake Lock解除されます

    beforeDestroy() {
        this.wakeLock.release();
        window.wakeLockInstance = null;
    },

ページ遷移は下記のコードでおこなっておりWakeLock解除を呼び出してからページ遷移を実行しています

    if (window.wakeLockInstance) {
        window.wakeLockInstance.release();
    }
    window.location.href = event.data.url;

何か情報いただけると助かります。
よろしくお願いいたします。

・beforeunload、visibilitychange、unloadでもWake Lockの解除を試しましたがいずれもWake Lock解除されませんでした
・beforeRouteLeaveでもWake Lock解除を試そうとしましたが、vue routerを使っての遷移ではないためか、beforeRouteLeaveが呼び出されませんでした
・Wake Lockの状態はadb shell dumpsys powerを使って確認しています

Using useState without setting state

I was going through this code by atlassian on how to use pragmatic-drag-and-drop in codesanbox.

There they have used

const [registry] = useState(getItemRegistry);

    // Isolated instances of this component from one another
const [instanceId] = useState(() => Symbol('instance-id'));

Trying to understand, what’s the use of using state, without ever being able to setState? like they don’t have const [registry, setRegistry] = useState(getItemRegistry);. Couldn’t this be useMemo instead?

Sandbox link

NPM ci copies wrong files to node_modules/@quasicomp/myOtherApp-mobile/node_modules/3rdPartyLib

I have two local npm projects – myMainApp and myOtherApp. For both, i install the requirements with npm ci from an existing package-lock.json file. myMainApp has a reference to the other app in it’s package-lock.json:

"node_modules/@quasicomp/myOtherApp-mobile": {
            "version": "37.11.0",
            "license": "UNLICENSED",
            "dependencies": {
                "@angular/animations": "^18.0.2",
                "@angular/cdk": "^18.0.2",
                [......]
                "3rdPartyLib": "^11.0.0",
                "vscroll": "^1.6.1"
            },
            "resolved": "../../myOtherApp/v37.11.0/packages/mobile"
        },

Other references are resolved via npm registry.
Running npm ci (tested with npm 20.11.1 and 22.11.0) on myOtherApp works, npm run build does what it should.

If i run npm ci on myMainApp however the result is strange: Under myMainApp/node_modules/@quasicomp/myOtherApp-mobile/node_modules/3rdPartyLib is a copy of myOtherApp-mobile again, package.json and everything. Running npm run buidl failes because 3rdParyLib can not be resolved.

It had worked in the past, but now i got this strange error i can not fix. I get the same if i run on a clean docker container. Does anyone has at least an idea of why npm copies the wrong files to the sub node_modules project?

I tried running npm ci on myMainApp before and after npm run build on the other app, i tried different npm versions.. Can’t find any difference.