AlpineJS – template x-if not prevent rendering

I have this code snippet. It’s a bit long but that’s the shortest I could make it to reproduce the error.
The idea is to have a data variable which displays selected data and a template object from which the user can select entries which should be added to data.

When I select the values from the three drop downs and click “add” it works the first time. But when I repeat it the second time I get this error:

Alpine Expression Error: Cannot read properties of undefined (reading '')
Expression: "Object.keys (template[select.a][select.b])"

<template x-for="i in Object.keys (template[select.a][select.b])" :key="i">...</template>

Uncaught TypeError: Cannot read properties of undefined (reading '')
    at [Alpine] Object.keys (template[select.a][select.b]) (eval at <anonymous> (https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js:5:665), <anonymous>:3:63)
...

But on line 44 and 53 I have x-if directives to check if select.a and select.b is != ''. This should prevent the following code from being executed/rendered at all. Is this a bug in alpine or do I make something wrong?

<html>
    <head>
        <script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
        <script>
            function App() {
                return {
                    template: {
                        a: {
                            b: {
                                c: 1
                            }
                        },
                    },
                    data: [],
                    select: {
                        a: '',
                        b: '',
                        c: '',
                    },
                    add: function () {
                        this.data.push (this.template[this.select.a][this.select.b][this.select.c]);
                        
                        this.select = {
                            a: '',
                            b: '',
                            c: '',
                        };
                    }
                };
            }
        </script>
    </head>
    <body x-data="App()">
        data: <div x-html="JSON.stringify (data)"></div>
        
        <div>
            <select x-model="select.a">
                <option disabled selected="selected" value="">choose</option>
                <template x-for="i in Object.keys (template)" :key="i">
                    <option :value="i" x-html="i"></option>
                </template>
            </select>
            
            <template x-if="select.a != ''">
                <div>
                    <select x-model="select.b">
                        <option disabled selected="selected" value="">choose</option>
                        <template x-for="i in Object.keys (template[select.a])"  :key="i">
                            <option :value="i" x-html="i"></option>
                        </template>
                    </select>
                    
                    <template x-if="select.b != ''">
                        <div>
                            <select x-model="select.c">
                                <option disabled selected="selected" value="">choose</option>
                                <template x-for="i in Object.keys (template[select.a][select.b])" :key="i">
                                    <option :value="i" x-html="i"></option>
                                </template>
                            </select>
                            
                            <template x-if="select.c != ''">
                                <button @click="add()">add</button>
                            </template>
                        </div>
                    </template>
                </div>
            </template>
        </div>
    </body>
</html>

Checkbox is selected but is returning false in code behind

I have a checkbox in a form. When I click the only button on the form, it calls a JS function. I put some logic in the function that alerts me if the checkbox is selected. If the checkbox is selected, it comes back true. Otherwise it comes back false. The JS alert works perfectly as intended.

However, after the postback from the button being clicked, I have logic pertaining to the Checkbox in C#. I have put the logic everywhere in the page and still cannot figure out the problem.

if (myCheckbox.Checked)
{
  // Certain code is implemented.
}
else
{
  // Other code is implemented.
}

Right now I have the code in the Page_LoadComplete(object sender, EventArgs e). I have verified in the code behind .cs file, any code pertaining to the status of the Checkbox (example: myCheckbox.Checked = false) is commented out. I have been looking at this around the clock for two days and it is driving me crazy. How is it possible I am getting a false value after the postback when the Javascript says it is selected (when it is selected) and not selected (when it is not selected).

  • I tried putting the logic (if (checkBox.checked)) everywhere in the page and am getting the same result.

  • I tried calling a JS function from the C# code behind file but found out I can’t return a value that way.

  • I tried using a HiddenField value to store the status of the Checkbox and that was unsuccessful as well.

  • I’ve searched the internet trying similar things other people used but had no luck.

I have and error and I repaired it but it’s still : Failed prop type: Invalid prop `textStyle` of type `array` supplied to `Cell`, expected `object`

This error comes out when I load the page of a react project and I have already fixed it several times but it is still there I don’t know what is happening: This is the part where the “problem” is

const Tabla = ({ title, data }: { title: string; data: string[] }) => {
    const headerTextStyle = { ...styles.headerText, ...styles.rowText, fontSize: 16 };
  
    return (
      <View>
        <Text>{title}:</Text>
        <Table>
          <Row data={['Nombre']} style={styles.headerRow} textStyle={headerTextStyle} />
          {data.map((item: string, index: number) => (
            <Row key={index} data={[item]} style={styles.row} textStyle={headerTextStyle} />
          ))}
        </Table>
      </View>
    );
  };

I tried to change the code so that it was taken as an object but it didn’t work

Javascript onclick event based on corresponding id iterations

I am attempting to create dynamic modal popups from query feeds in WordPress. One feed displays elements that need to be clicked and one feed holds the content for the modal popups. My current code adds an iterated id to all elements with a certain class if the parent has a certain id. This is occuring for the two different parent containers.

My problem is I want it to work so when you click on id=”team-0″ it will open the corresponding id=”modal-0″;

Here is my javascript:

const modalContainer = document.getElementById('modalContainer');
const modal = modalContainer.querySelectorAll('.team');

  modal.forEach((element, index) => {
    element.id = `modal-${index}`;
  });

const teamContainer = document.getElementById('teamContainer');
const team = teamContainer.querySelectorAll('.team');

  team.forEach((element, index) => {
    element.id = `team-${index}`;
  });

The HTML looks similar to this:

<div id="teamContainer">
<ul>
<li id="team-0" class="team"></li>
<li id="team-1" class="team"></li>
<li id="team-2" class="team"></li>
</ul>
</div>

<div id="modalContainer">
<ul>
<li id="modal-0" class="team"></li>
<li id="modal-1" class="team"></li>
<li id="modal-2" class="team"></li>
</ul>
</div>

The current way I am trying to make this work (but I understand if this is just completely wrong):

window.onload = function(){ 
  for (let i = 0; i < 10; i++) {
    let teamId = `team-${i}`;
    let teamIndex = document.getElementById(teamId);

    let modalId = `modal-${i}`;
    let modalIndex = document.getElementById(modalId);

    teamIndex.onclick = function() {
      modalIndex.style.display = "block";
    }
  }
};

Thank you for any responses and let me know if you need more information.

How to simplify expression for checking object’s fields for undefined value in typescript?

I need to check the textAreaRef.current and textAreaRef.current.resizableTextArea for undefined value.

That works:

if (textAreaRef.current && textAreaRef.current.resizableTextArea) {
  const currentCursorPosition = textAreaRef.current.resizableTextArea.textArea.selectionStart;
}

But that don’t:

function isTextAreaExists() {
  return textAreaRef.current && textAreaRef.current.resizableTextArea;
}

if (isTextAreaExists()) {
  const currentCursorPosition = textAreaRef.current.resizableTextArea.textArea.selectionStart;
}

TS18047: textAreaRef.current is possibly null
TS18048: textAreaRef.current.resizableTextArea is possibly null

Are there ways to simplify the expression?

Custom Element with Leaflet not rendering correctly after client-side navigation in SvelteKit

I built a custom element using Leaflet that renders all the elements on the map by simply passing a JSON object.

The map works perfectly on a full page reload, but when navigating between different pages (using client-side navigation in SvelteKit), and then returning to the map, the elements don’t display, and a Leaflet error is thrown. It seems like the map is not being reinitialized properly after navigation.

What could be causing this issue, and how can I ensure the map is correctly initialized when navigating back to the page?

I tried different SvelteKit methods for re-rendering the component or reloading the script every time I navigate to the page, but none of these attempts worked.

SSR is off.

d3 axis labels and ticks are invisible

I am trying to view the axis labels of my d3 timeline chart. We are using v3 of d3 at work which can’t be easily changed (there are many charts written this way)

For some reason that I can’t figure out for the life of me, the CSS of the text elements inside the SVG are not visible. The elements exist in HTML, and they can be selected using the inspector, but I cannot see the labels or the ticks.

enter image description here

My code is as follows:

execution_history.js:

var COLORS = ["green", "red", "blue", "orange", "indigo",
              "fuchsia", "black", "cyan", "darkgreen", "pink"];

var MARGINS = {
    top : 0,
    bottom : 0,
    left: 0,
    right: 0
};


var TRANSLATE = function(x,y) {
    return "translate(" + x + "," + y + ")";
};


var createGraphRoot = function(rootNode, params) {
    d3.select(rootNode).selectAll("svg").remove();

    var margins = params.margins || MARGINS;

    var root = d3.select(rootNode)
                 .append("svg:svg")
                    .attr("width", params.width + margins.left
                                                + margins.right)
                    .attr("height", params.height + margins.top
                                                  + margins.bottom)
                 .append("g")
                    .attr("transform", TRANSLATE(margins.left,
                                                 margins.top));

    return root;
};

var applyScales = function(root, xScale, yScale) {
    var xAxis = d3.svg.axis().scale(xScale).orient("bottom").ticks(d3.time.day, 1);
    var yAxis = d3.svg.axis().scale(yScale).orient("left");

    /*var maxRange = function(scale) {
        // rangeExtent is more accurate for ordinal scales
        return d3.max((scale.rangeExtent || scale.range)());
    };
     */

    root.append("g")
        .attr("class", "x axis")
        .attr("transform", TRANSLATE(0, yScale.rangeExtent()[1]))
        .call(xAxis);

    root.append("g")
        .attr("class", "y axis")
        .call(yAxis);
};

var fillWithData = function(root, data, xScale, yScale, barColor) {
    root.selectAll("rect")
        .data(data)
        .enter().append("rect")
        .attr("x", function(d) { return xScale(d.start); })
        .attr("y", function(d) { return yScale(d.name); })
        .attr("width", function(d) { return xScale(d.end) - xScale(d.start); })
        .attr("height", yScale.rangeBand())
        .attr("fill", barColor);
}

////////////////////////////////////////////////////////////////////////////
// Exports


var executionHistoryTimeline = function(rootNode, data, startDate, endDate) {
    data = [
        {name: "Task 1", start: new Date("2023-05-01"), end: new Date("2023-05-02")},
        {name: "Task 2", start: new Date("2023-05-02"), end: new Date("2023-05-03")},
        {name: "Task 3", start: new Date("2023-05-01"), end: new Date("2023-05-03")}
    ];
    startDate = new Date("2023-05-01");
    endDate = new Date("2023-05-03");

    var width= 800, height= 200;
    var root = createGraphRoot(rootNode, {width:width, height:height});

    var xScale = d3.time.scale()
        .domain([new Date(startDate), new Date(endDate)])
        .range([0, width])

    var yScale = d3.scale.ordinal()
        .domain(data.map(function(d) { return d.name; }))
        .rangeRoundBands([0, height], 0.1);

    applyScales(root, xScale, yScale);
    fillWithData(root, data, xScale, yScale, 'steelblue');
}

execution_history.css:

/* Ensure SVG elements are visible */
.axis path,
.axis line {
    fill: black;
    stroke: black;
    shape-rendering: crispEdges;
    visibility: visible;
}

.axis text {
    fill: black;
    font-size: 12px;
    visibility: visible;
}

text {
    fill: black;
}

rect {
    fill: #009900;
    stroke: black;
    stroke-width: 1px;
}

What I have tried so far is manually updating the fill, stroke, color, fields both in CSS & in the inspector, all the way up the chain to the SVG, and still nothing. I’ve tried adding visibility tags to every element as well. I’ve tried adding the fill attributes directly to the axis creation like this post said: d3js v4 x-axis-label is there but not visible but this also had no visible changes.

Can anyone provide some assistance as to what might be going on here? I’m not even sure what to investigate next. I attribute d3 to voodoo magic at this point, and I’ve got some deliverables that I need to hit this sprint. I’d rather not try to bring in a new charting standard.

I’m happy to provide any other details necessary, but you should be able to reproduce based on the code I posted above.

Thank you in advance!

Why i can access dahsboard even when my login fail?

I’m having trouble with authentication where I have a Laravel backend and a Nuxt frontend. When I log in and log out successfully, everything works fine. The problem occurs when the login fails due to incorrect credentials, yet I’m still able to access the dashboard. Even though the login fails, I can see a new XSRF token being added in the browser’s Application tab. The issue is that I can access the dashboard and even the profile section, but when I try to log out, I get an error saying I’m unauthorized, which makes sense because the token wasn’t provided. However, for some reason, a session with the XSRF token is hanging around, causing me to be partially logged in even though I’ve entered incorrect login credentials. Does anyone know what could be causing this issue? I’m new to REST APIs, so I’m probably doing something very wrong.
This is my useAuth.js

export default function useAuth() {
    const user = useState('auth-user', () => null)

    const { errorBag, transformValidationErrors, resetErrorBag } = useCustomError()

    const { api, csrf } = useAxios()

    async function me() {
        try {
            const data = await api.get("/api/me")
            user.value = data.data
        } catch (e) {
            user.value = null
            console.log("error")
        }
    }

    function login(userForm) {
        resetErrorBag()
        csrf().then(() => {
            api.post("/login", userForm).then(({ data }) => {

                user.value = data.user

                $fetch('/api/set-cookie', {
                    method: "POST",
                    body: { token: data.token }
                }).then(res => {
                    navigateTo("/dashboard")
                })
            }).catch(err => {
                transformValidationErrors(err.response)
            })
        })
    }


    function logout() {
        api.post("/api/logout").then(() => {
            user.value = null
            $fetch('/api/logout', {
                method: "POST",
            }).then(res => {
                navigateTo("/")
            })

        })
    }

    function register(userForm) {

        resetErrorBag()
        csrf().then(() => {
            api.post("/register", userForm).then(({ data }) => {
                //   verify email screen
            }).catch(err => {
                transformValidationErrors(err.response)
            })
        })
    }


    return { login, logout, register, errorBag, user, me }

}

this is my useAxios.js

import axios from "axios";

export default function useAxios(){

    const rtConfig = useRuntimeConfig()
    let api = axios.create({
        baseURL: rtConfig.public.API_URL,
        headers: {
            "Content-Type": "application/json",
            "Accept": "application/json",
            // "Authorization:": "Bearer " + localStorage.getItem("token"),
        },
        withCredentials: true,
        withXSRFToken: true
    })



    async function csrf(){
        return await api.get("/sanctum/csrf-cookie")
    }

    return {
        api, csrf
    }
}

guest middleware

export default defineNuxtRouteMiddleware((to, from) => {


    const key = process.server ? 'token' : 'XSRF-TOKEN'

    const token = useCookie(key)


    if(token.value)
        return navigateTo('/')


  })
  

auth middlware

export default defineNuxtRouteMiddleware((to, from) => {


    const key = process.server ? 'token' : 'XSRF-TOKEN'

    const token = useCookie(key)


    if(!token.value)
        return navigateTo('/')



  })

So even when I defined auth middleware for dashboard page lije this

definePageMeta({
    middleware: ['auth']
  })

I can still access it, but at all I’m not authorized. I don’t understand where is mistake :/

Connecting account with a post on Wix

I am using Wix to create my site, and I would like to know how to connect a user account with a post they made. For example, I’m creating a feature where users can submit data to a CMS, such as a dog’s name and a video of their dog. When they click to submit the data, it should be displayed on a page where the dog’s name and video can be viewed by everyone. However, only the creator of the post should be able to edit or delete it.

I’ve already created the ‘CMS form page’ with inputs for the dog’s name and dog video. When I click to submit the data, it goes to another page where all the data I create using the form is displayed for everyone.

How to get the object with the smallest uuid from an array in React?

I have an array of objects in React, where each object has a uuid and a name property. I’m trying to find the object with the smallest uuid value.

let smallestUuidObject = {};
const arr = [{uuid:1, name:'john'}, {uuid:2000, name:'john2'}];
smallestUuidObject = arr.reduce((prev, curr) => {
  return prev.uuid < curr.uuid ? prev : curr;
});

With this approach, I’m getting {uuid:1, name:’john’} as the response, which is correct. However, I want to confirm if this is the best approach or if there is a more efficient or cleaner way to achieve this.

Could someone please review my code and suggest improvements if necessary?

How can I detect if a YouTube video is HDR using JavaScript?

I want to detect if the video which is played is hdr or not automatically.

YouTube Data API: I looked into the YouTube Data API v3 but found no explicit indicators for HDR content in the video metadata.

Client-Side Detection: I considered checking video properties via a element in JavaScript, but it seems that browsers do not expose HDR-related properties.

I’m trying to create a clicker game [closed]

I’m trying to create a clicker game website with an image of an apple as the button. I’m not trying to get my website posted online though. I’m trying to bring the apple to the center but it’s not working. Also, I’m trying replace the header element with ‘You win!’ When you reach a score of ten, but that’s not working either. Based on the code below, does anybody have any suggestions or ideas?
I’m kind of new to Web Development as you can see.

var number = 0;

function add1() {
  number += 1;
  document.getElementById("counter").innerHTML = number;
}
// add1 function to add one and then output the result

if (number == 10) {
  document.getElementById("heading").innerHTML = "You win!";
} else if (number == 5) {
  document.getElementById("heading").innerHTML = "You're almost there!";
} else if (number == 7) {
  document.getElementById("heading").innerHTML = "You're nearly there!";
} else {
  document.getElementById("heading").innerHTML = "Keep going!";
}
body {
  background-color: rgb(255, 169, 0);
}

h1,
p {
  text-align: center;
}

button {
  align-self: center;
  background-color: rgb(240, 248, 255);
}

img {
  display: flex;
  align-items: center;
  justify-content: center;
}
<h1>Counter</h1>
<p id="counter">0</p>
<button onclick="add1()"><img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIADYAXAMBEQACEQEDEQH/xAAcAAEAAgIDAQAAAAAAAAAAAAAABQcCBgMECAH/xAAvEAABAwMBBwIEBwAAAAAAAAABAAIDBAURMQYSEyFBYYFRcTJCkeEHI4KhsbLx/8QAGwEBAAIDAQEAAAAAAAAAAAAAAAQFAgMGAQf/xAAtEQEAAgECBAQEBwEAAAAAAAAAAQIDBBEFEiExE0FR0RRxseEiMmGBkcHwBv/aAAwDAQACEQMRAD8AvFAQEBAQEHQmvNshcWy19M1w1HEGQtVs+Kve0MJyUjvLuxvbJG2Rhy1wBafULZE79WbJeggICAgICAg+ZQa7tk6pkp6SipnFgqZC2Rwz8IGT41PhQ9ZzTEUr5o2o3mIrHm0+3Wx90rGx0sT46UHDpX9G9STpnsPuq7Hh8W+1Y6ImPFOS21Y6LRja1rGtYMNAwB2V7EbLSGSAgICAgICDXduL++w2kPpgDVTv4cRIyG8sl2Ow/chac+Tw69O6x4Zoo1eflt+WOs+ynqmrqauYzVdTNNITnekeXH7Ktm0zO8y7bHix468tKxEJS2bVXe2xmOOo4zRnhioBk4RwRluTy5E8tOyzrmvVC1HCtLqLRa1dpj06b/7+UXXVVRcZTLXzyVMmc70rt7Ht6eFha027puHFTDXlxxtH6JvY7aGps1yghMr3UErwySEnLWgnG80dMa8tQtuHLNLbeSv4noMepxWtEfjjrv8A0uhWbiBAQEBAQEFe/i5G4w2yX5A+Rh9yAR/UqHq46Q6P/nrRz5K+e0K4UF04gIM4I3TTxRM+OR7WN9ycBex1lje0VrNp8oehhorl83EBAQEBAQQO21qN32eqIYm708eJYR6ub08jI8rVnpz0mE/hmp+H1NbT2npPyn27qUByMqqd4I8EGzfh7ajctoYpnNzBR/nPJ03vkH15/pUjT05r7+ip4zqYw6aax3t09/b91xqycWICAgICAgIKn272WqKG5PrbfTySUlQS5wiaXcJ51BA6HUfT0VfnwzWd69nX8J4lTJi8LLba1fXzj7ff1QNLs7eqthfT2uqc0dXM3M+29jPhaYxXntCwya/S452tkj6/Tdwiz3Q1IpxbazjE4DDC4fyNO+i88O++2zZ8Xp+Xn542+cLh2RsTLDaWU5w6oed+d46u9B2Gn+qyxY/Drs4niGsnV5pv5R0j5JtbUIQEBAQEBAQEBAQEBAQEBB//2Q=="></button>

Angular DevExpress popup not showing title on first load

For some reason when I open the popup it doesnt show the title (My Title) on the first open. If i close it and reopen it works fine after that.

What could be the reason for this?

html:

<div class="d-flex justify-content-end align-items-center icon-list">
    <div *ngFor="let connector of connectors; let i=index" class="icon-item">
        <span id="connector-{{conn.Id}}" role="button" (click)="openPopup(conn, $event)">
        </span>
        <dx-tooltip [target]="'#con' hideEvent="mouseleave"
            position="bottom">{{ conn.Name}}</dx-tooltip>
    </div>
</div>
<dx-popup [showTitle]="true" [title]="MyTitle" [(visible)]="showPopup" width="auto" height="auto" [resizeEnabled]="true" >
    <dxo-position [of]="popupPosition.of" [at]="popupPosition.at" [my]="popupPosition.my"
        [offset]="popupPosition.offset">    
    </dxo-position>
    <app-conn-item *ngIf="currentSelection" [conn]="currentSelection" [bp]="bp"></app-conn-item>
</dx-popup>

component:

  currentSelection: IntConn | null = null;
  MyTitle;
  showPopup: boolean = false;

  openPopup(conn: IntConn, event: MouseEvent): void {

    // find the position of the popup
    const targetElement = event.target as HTMLElement;
    const rect = targetElement.getBoundingClientRect();

    this.popupPosition = {
      of: targetElement,
      my: 'right top',
      at: 'right top',
      offset: { x: 0, y: rect.height }
    };


    // set the connector and show the popup
    this.currentSelection = conn;
    this.MyTitle = "asdfd";
    this.showPopup = true;
  }

‘ReferenceError: Response is not defined’ in Jest with Node 20 when using msw

I’m using msw package to mock server response on Jest tests. I have a setupTests.js file which calls the tests/mocks/server.js file, which in turn calls the tests/mocks/handlers.js file. When I run my tests I get the error:

ReferenceError: Response is not defined

I tried setting

const fetch = global.fetch
Object.assign(global, {fetch});

in setupTests.js and in jest.polyfill,js. Also tried setting it in jest.config.json.

Nothing works. Keep getting the same error. Please help.

I’m using "msw": "^2.3.5", "jest": "^29.7.0" and node 20.14.0.

setupTests.js:

import { TextDecoder, TextEncoder } from "util";

import { server } from "./tests/mocks/server";

Object.assign(global, { TextDecoder, TextEncoder });

beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());

// Mocking the canvas
global.HTMLCanvasElement.prototype.getContext = jest.fn(() => ({
  fillRect: jest.fn(),
}));

global.ResizeObserver = jest.fn().mockImplementation(() => ({
  observe: jest.fn(),
  unobserve: jest.fn(),
  disconnect: jest.fn(),
}));

server.js:

import { setupServer } from "msw/node";

import { handlers } from "./handlers";

export const server = setupServer(...handlers);

handlers.js:

import { http, HttpResponse } from "msw";

export const handlers = [
  http.post(
    "https://a-website.com/",
    async (request) => {
      const { user_action } = await request.json();
      if (some_status === "something") {
        return HttpResponse.json({
          random_array: [
            {
              some_key: "some_value",
            },
          ],
        });
.
.
.
.
.

Performance issue rendering large tree (~10,000 nodes) using d3-org-chart library

I’m using the d3-org-chart library in React to display a tree with around 10,000 nodes in my web application. The chart rendering is extremely slow, especially on lower-end machines, and the UI freezes during the rendering process.

Here is the code I am currently using:

    new OrgChart()
    .container(".chart-container")
    .data(data)
    .svgHeight(1200)
    .svgWidth(2000)
    .nodeWidth((d) => 250)
    .initialZoom(0.7)
    .firstDraw(firstDraw)
    .nodeHeight((d) => 250)
    .childrenMargin((d) => 90)
    .compactMarginBetween((d) => 60)
    .compactMarginPair((d) => 140)
    .expandAll(true)
    .compact(false).
    .render();

Nothing too complicated; it’s based on the examples provided in the documentation. However, rendering takes a long time, and during the process, the chart freezes.

Has anyone had similar performance issues when working with large datasets in d3-org-chart? What are some best practices or optimizations I can apply to improve performance and avoid freezing the UI?

Any advice would be appreciated!