Playwright nightly (firefox) headed mode, browser is not responding

I am using
playwright version 1.41.2
node v21.6.1
win11 Pro build 22631 x64
Lenovo PC
JavaScript and TypeScript. I have an issue when running a test in headed mode with the Firefox (nightly) browser (firefox-1438). Browsers were installed over npm install @playwright. Every browser works fine (chromium, webkit, edge) except nightly in headed mode. In headless mode nightly works fine. Well, I am not receiving any error and testing is executed without a defect.
I am running a simple test delivered by the Playwright team.
Script:
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('``https://playwright.dev/``');
await expect(page).toHaveTitle(/Playwright/);
});

What I did: uninstall node, uninstall pw and reinstall. Manually deleted browsers from ms-playwright folder and reinstalled them. Delete browser over command: npx playwright uninstall –all and reinstall. Any ideas?
Kind regards.

Dynamically add/remove DateFields in Django formset

I have a very specific problem which is related to the package django-bootstrap-datepicker-plus.

In my Todo list application I want to have the possibility to have tasks pop up on a number of specific dates. I got my model set up, I got my form including a formset set up, and I even have a JavaScript that handles the dynamic add/remove procedure.

The problem that I have is that the cloning process of my DateField somehow messes with the DatePicker divs – see the outcome in the last code block below.

# model.py
from django.db import models
from datetime import time

# Create your models here.
class Task(models.Model):

    id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=50, default="")
    description = models.CharField(max_length=500, default="")
    entry_date = models.DateTimeField(auto_now_add=True)
    last_updated = models.DateTimeField(auto_now=True)
    specific_dates = models.ManyToManyField('SpecificDate', blank=True)
    due_until = models.TimeField(auto_now_add=False, default=time(12, 0))


class SpecificDate(models.Model):
    todo = models.ForeignKey(Task, on_delete=models.CASCADE)
    date = models.DateField(auto_now_add=False, blank=True, null=True)

    class Meta:
        # ensure each specific date is unique per task
        unique_together = ('todo', 'date')
# forms.py
from bootstrap_datepicker_plus.widgets import DatePickerInput, TimePickerInput
from django import forms
from .models import Task, SpecificDate

class TaskForm(forms.ModelForm):
    class Meta:
        model = Task
        fields = [
            'title',
            'description',
            'due_until',
            ]
        widgets = {
            'due_until': TimePickerInput(options={'stepping': 5, 'format': 'HH:mm'}),
            'description': forms.Textarea({'rows': 3}),
        }


class SpecificDateForm(forms.ModelForm):
    class Meta:
        model = SpecificDate
        fields = ['date']
        widgets = {
            'date': DatePickerInput(),
        }


SpecificDateFormset = forms.inlineformset_factory(
    Task, SpecificDate,
    form=SpecificDateForm,
    fields=('date',),
    extra=1,
    can_delete=True
)
<!-- task_form.html -->
{% extends "task/base.html" %}
{% load crispy_forms_tags %}
{% load bootstrap4 %}
{% bootstrap_css %}
{% bootstrap_javascript jquery='full' %}
{% block content %}
<div class="content-section">
    <form method="POST">
        {% csrf_token %}
        <fieldset class="form-group">
            <legend class="border-bottom mb-4">New entry</legend>
            {% if form.non_field_errors %}
            <div class="alert alert-danger">
                {{ form.non_field_errors }}
            </div>
            {% endif %}
            {% crispy form %}
            <div id="formset-container">
                {{ formset.management_form }}
                {% for form in formset %}
                    {% if form.errors %}
                    <div class="alert alert-danger">
                        {{ form.errors }}
                    </div>
                    {% endif %}
                    <div id="formset-date" class="formset-date d-flex align-items-center">
                        <div class="flex-grow-1 mr-2">
                            {{ form.date|as_crispy_field }}
                        </div>
                        <div>
                            <button type="button" class="btn btn-sm btn-danger remove-date" name="remove-date">-</button>
                            <button type="button" class="btn btn-sm btn-success add-date" name="add-date">+</button>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </fieldset>
        <div class="form-group">
            <button class="btn btn-primary" type="submit" name="add_new">Save</button>
            <a class="btn btn-warning" href="{% url 'task-new' %}">Restart</a>
        </div>
    </form>
    {{ form.media }}
</div>
{% endblock content %}
// JavaScript for add/remove buttons
document.addEventListener('DOMContentLoaded', function() {
    const formsetContainer = document.getElementById('formset-container');
    const formsetPrefix = 'specificdate_set';
    const totalFormsElement = document.getElementById('id_'+formsetPrefix+'-TOTAL_FORMS');
    
    // Adjusts name and id for cloned form elements
    function adjustNamesAndIds(newForm, newIndex) {
        newForm.querySelectorAll('[id], label').forEach(element => {
            // debugger;

            // First up, let's do a few if statements for elements we want
            // to skip.
            // ... buttons
            if (element.tagName === 'BUTTON') {
                console.log('Skipping button ' + element.name);
                return;
            }
            
            // ... formset management fields as they already have valid names
            if (element.type === 'hidden' && (element.value === '')) {
                console.log('Skipping formset management field or empty hidden field: ' + element.name);
                return;
            }
            
            if (element.tagName === 'LABEL' && element.htmlFor) {
                const htmlForMatch = element.htmlFor.match(/^(.+)-d+-(.+)$/);
                if (htmlForMatch) {
                    element.htmlFor = `${htmlForMatch[1]}-${newIndex}-${htmlForMatch[2]}`;
                }
            }
            
            if (element.dataset.name) {
                const nameMatch = element.dataset.name.match(/^(.+)-d+-(.+)$/);
                if (nameMatch) {
                    element.dataset.name = `${nameMatch[1]}-${newIndex}-${nameMatch[2]}`;
                }
            }

            if (element.name) {
                const nameMatch = element.name.match(/^(.+)-d+-(.+)$/);
                if (nameMatch) {
                    element.name = `${nameMatch[1]}-${newIndex}-${nameMatch[2]}`;
                }
            }
            
            // Update IDs for inputs and corresponding labels, if applicable
            if (element.id) {
                const idMatch = element.id.match(/^(.+)-d+-(.+)$/);
                if (idMatch) {
                    const newId = `${idMatch[1]}-${newIndex}-${idMatch[2]}`;
                    element.id = newId;
                    const label = newForm.querySelector(`label[for="${element.id}"]`);
                }
            }
        });
        
        // // Additionally, update div IDs related to the form fields for
        // // consistency
        // newForm.querySelectorAll('div[id]').forEach(div => {
        //     const idMatch = div.id.match(/^(.+)-d+-(.+)$/);
        //     if (idMatch) {
        //         div.id = `${idMatch[1]}-${newIndex}-${idMatch[2]}`;
        //     }
        // });
    }
    
    function cloneForm() {
        let totalForms = parseInt(totalFormsElement.value, 10);
        let newFormIndex = totalForms;
        totalFormsElement.value = totalForms + 1;
        
        let newForm = formsetContainer.querySelector('.formset-date:last-of-type').cloneNode(true);
        if (newForm && typeof newFormIndex !== 'undefined') {
            adjustNamesAndIds(newForm, newFormIndex);
            formsetContainer.appendChild(newForm);
        } else {
            console.error('Error cloning form: newForm or newFormIndex is invalid.');
        }
    }
    
    formsetContainer.addEventListener('click', function(event) {
        if (event.target.classList.contains('add-date')) {
            console.log('Add');
            event.preventDefault();
            cloneForm();
        } else if (event.target.classList.contains('remove-date')) {
            console.log('Remove');
            event.preventDefault();
            if (formsetContainer.querySelectorAll('.formset-date').length > 1) { // Ensure at least one form remains
                let formToRemove = event.target.closest('.formset-date');
                formToRemove.remove();
            }
        }
    });
});

The HTML snippet with the formset after clicking the ‘add’ button looks like this:

<div id="formset-container">
  <input type="hidden" name="specificdate_set-TOTAL_FORMS" value="2" id="id_specificdate_set-TOTAL_FORMS"><input type="hidden" name="specificdate_set-INITIAL_FORMS" value="0" id="id_specificdate_set-INITIAL_FORMS"><input type="hidden" name="specificdate_set-MIN_NUM_FORMS" value="0" id="id_specificdate_set-MIN_NUM_FORMS"><input type="hidden" name="specificdate_set-MAX_NUM_FORMS" value="1000" id="id_specificdate_set-MAX_NUM_FORMS">
  <div id="formset-date" class="formset-date d-flex align-items-center">
    <div class="flex-grow-1 mr-2">
      <div id="div_id_specificdate_set-0-date" class="form-group">
        <label for="id_specificdate_set-0-date" class="">
          Date
        </label>
        <div>
          <div class="input-group dbdp">
            <input type="text" class="datepickerinput form-control" id="id_specificdate_set-0-date" data-dbdp-config="{&quot;variant&quot;: &quot;date&quot;, &quot;backend_date_format&quot;: &quot;YYYY-MM-DD&quot;, &quot;options&quot;: {&quot;locale&quot;: &quot;de-DE&quot;, &quot;format&quot;: &quot;DD.MM.YYYY&quot;}}" data-dbdp-debug="" data-name="specificdate_set-0-date">
            <div class="input-group-addon input-group-append input-group-text">
              <i class="bi-calendar"></i>
            </div>
          </div><input type="hidden" name="specificdate_set-0-date" value="">
        </div>
      </div>
    </div>
    <div>
      <button type="button" class="btn btn-sm btn-danger remove-date" name="remove-date">-</button>
      <button type="button" class="btn btn-sm btn-success add-date" name="add-date">+</button>
    </div>
  </div>
  <div id="formset-date" class="formset-date d-flex align-items-center">
    <div class="flex-grow-1 mr-2">
      <div id="div_id_specificdate_set-1-date" class="form-group">
        <label for="id_specificdate_set-1-date" class="">
          Date
        </label>
        <div>
          <div class="input-group dbdp">
            <input type="text" class="datepickerinput form-control" id="id_specificdate_set-1-date" data-dbdp-config="{&quot;variant&quot;: &quot;date&quot;, &quot;backend_date_format&quot;: &quot;YYYY-MM-DD&quot;, &quot;options&quot;: {&quot;locale&quot;: &quot;de-DE&quot;, &quot;format&quot;: &quot;DD.MM.YYYY&quot;}}" data-dbdp-debug="" data-name="null">
            <div class="input-group-addon input-group-append input-group-text">
              <i class="bi-calendar"></i>
            </div>
          </div><input type="hidden" name="null" value=""><input type="hidden" name="specificdate_set-0-date" value="">
        </div>
      </div>
    </div>
    <div>
      <button type="button" class="btn btn-sm btn-danger remove-date" name="remove-date">-</button>
      <button type="button" class="btn btn-sm btn-success add-date" name="add-date">+</button>
    </div>
  </div>
</div>

As you can see (if you look very closely), the dataset.name property of the DatePicker does not get updated. Or, well, it get’s updated – element.dataset.name has the correct name during processing – but in the rendered HTML it is back to the original name, and I also get those <input type="hidden" name="null" value=""> elements.

The question is simple: How can I get the correct dataset.names in the respective <input> fields, so that the POST request on submission has the correct elements?

Checking if an object’s property has an empty string in React Native

I have an object that either contains an image URL or not.

{ id: 1, term: "Research", imageURL: "", definition: "is a way of thinking and understanding various aspects of a procedure to society.", }

I created a function that is supposed to read whether the imageURL is not empty then show the image and if yes, shows different content, but it throws an error that says, “This condition will always return ‘false’ since JavaScript compares objects by reference, not value. ts(2839)”

`const imageURL = item.imageURL

{ imageURL === “” ? (shows with no image) : (shows with image)}`

Is there a way to read the object’s property that contains a string whether its empty or not? Thank you!

How to Validate Google Map ID which is used for Map Options

How to Validate Google Map ID which is used for Map Options

hdr_loadGoogleMap: function() {
        var me = this,
            vFormPanel = me.getFormPanel(),
            vFldValues = vFormPanel.getFldValues(['install_gmapikey','install_gmapid','install_gmapcoor','install_gmaptype']),
            vContainer = vFormPanel.down('container[hostCmpId=mapContainer]'),
            vLat,
            vLng,
            vGmapcoor = vFldValues['install_gmapcoor'].split(','),
            vGMapTypes = {
                'map': 'roadmap',
                'satellite': 'satellite',
                'terrain': 'terrain',
                'labels': 'hybrid'
            };


vLanguageCode ='en';
        Ext.Loader.loadScript({
            url: 'https://maps.googleapis.com/maps/api/js?key=inavlidkey&v=3.55&language='+vLanguageCode,
            onLoad: function () {
                 me.hdr_gmap = Ext.create('Ext.panel.Panel', {
                    layout: 'fit',
                    header: false,
                    border: false,
                    itemId: 'map',
                    style: 'padding: 0; border-width: 0;',
                    draggable: false,
                    height: 290,
                    width: 350,
                    items: [{
                        xtype: 'uxgmappanel',
                        useCurrentLocation: true,
                        center: {
                            lat: vLat,
                            lng: vLng
                        },
                        mapOptions: {
                            zoom: 14,
                            mapTypeId: 'roadmap', 
                           ** mapId: 'IncorrectedValue'**
                        }
                    }]
                });
                vContainer.add(me.hdr_gmap);
            }
        });

In above, i am sending Incorrected Value for the Map ID. Please suggest.

https://maps.googleapis.com/maps/api/mapsjs/mapConfigs:batchGet. in this call, getting response like Map ID is not valid.

I need to display alert message in javaScript if MAp ID is invalid.

React Javascript function malfunctionning on website [closed]

I am building a React app that aims to translate to and from morse code as well as read out the result.
This works perfectly fine on PC but the mobile version (specifically on iphone) malfunctions completely, playing the wrong letters and waiting the wrong time.

I suspect that it is an issue with the sleep function.

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function playSound(partition, vitesse) {
    let letter;
    let shortsound;
    let longsound;
    let shorttime;
    let longtime;

    if(vitesse==='1'){
        shortsound = courtlg;
        longsound = longlg;
        shorttime=800;
        longtime=1000;
    }
    else {
        shortsound = courtsh;
        longsound = longsh;
        shorttime=400;
        longtime=500;
    }

    for (let i = 0; i < partition.length; i++) {
        if (partition[i] !== letter) {
            letter = partition[i];
        }
        if (letter === '.') {
            shortsound.play();
            //pause for 245 ms
            await sleep(shorttime);
        }
        else if (letter === '-') {
            longsound.play();
            await sleep(longtime);
        }
        else if (letter === ' ') {
            await sleep(shorttime);
        }
        else if (letter === '/') {
            await sleep(longtime)
        }
        else {
            await sleep(1000)
        }
    }

I tried different ways to wait for time which is why I had to write the sleep funciton, the function is async to allow it to wait.

Highchart draw line if there is one point

I have the following chart with 1 point:

enter image description here

Is there a way to draw a line from this point or convert the point to a line like the following screenshots?

enter image description here

or

enter image description here

A fiddle to test: https://jsfiddle.net/ak8xcd7s/

HTML:

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container"></div>

JS:

const chart = Highcharts.chart('container', {
    yAxis: {
        min: 0,
        max: 100
    },
    xAxis: {
        categories: ['02-2024']
    },
    series: [{
        data: [20],
        pointPlacement: 'on'
    }],
});

Add Download Button to Serve Converted Document File on Completion

from flask import Flask, render_template, request, send_file

from werkzeug.utils import secure_filename
from pdf2docx import Converter

app = Flask(__name__)


@app.route('/to-doc', methods=['POST', 'GET'])
def pdfdoc():
    docx_file = r"C:UsersAchinthaDesktop2nd Y 2FlaskAppprojectconverted_documeneet.docx"
    upload_success = False
    converted_filename = "converted_document.docx"

    if request.method == 'POST':
        file = request.files['pdf']
        filename = secure_filename(file.filename)
        file.save(filename)
        upload_success = True

        cv = Converter(filename)
        convert_File = cv.convert(docx_file)
        if convert_File == "success":
            return render_template('done.html', filename='converted_document.docx')

    return render_template('pddoc.html', upload_success=upload_success)


@app.route('/done/<filename>')
def download(filename):
    return send_file(filename, as_attachment=True)


# debug mode
if __name__ == '__main__':
    app.run(debug=True)

when convert button press pdf convert to the document file, it works good . Now I want to add download button to download the doc file after complete,
After file completely convert should go to the (done.html) file and on the site has the download button how to do this.

my for loop return 1 value from another array [duplicate]

here is the array I am making the query to.

newArray = [
    {
        "value": 2554,
        "label": "This is my post",
        "content": "&#8220;There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain&#8230;&#8221;",
        "image": "http://localhost:8888/new-site/wp-content/uploads/2023/03/Arrow-01-300x300-1.png",
        "link": "http://localhost:8888/new-site/2024/02/10/this-is-my-post/",
        "catagory": "newCat"
    },
    {
        "value": 2468,
        "label": "Will this work",
        "content": "blah blah blah",
        "image": "http://localhost:8888/new-site/wp-content/uploads/2023/03/Jody-Findley-HEADSHOT-002.png",
        "link": "http://localhost:8888/new-site/2024/02/09/will-this-work/",
        "catagory": "vtalk"
    },
    {
        "value": 2037,
        "label": "This is the title",
        "content": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,",
        "image": "http://localhost:8888/new-site/wp-content/uploads/2024/01/6W4A2713-2-scaled.jpg",
        "link": "http://localhost:8888/new-site/2024/01/18/bob-smith-talk/",
        "catagory": "newCat"
    },
    {
        "value": 965,
        "label": "This is not the right id",
        "content": "The Arts Industry Is Worth Over 90 Billion Pounds A Year And Is One Of The Fastest Growing Industries Wednesday 17th May KS3-5 / S1-6 In the working world, there are a huge amount of creative careers available, and though it may be a competitive industry there are many opportunities. In this broadcast Simon will [&hellip;]",
        "image": "http://localhost:8888/new-site/wp-content/uploads/2024/01/R7A9265-2-scaled.jpg",
        "link": "http://localhost:8888/new-site/2023/05/26/this-is-not-the-right-id/",
        "catagory": "vtalk"
    },
    {
        "value": 959,
        "label": "Why Study RE With Alec Ryrie, Professor of the History of Christianity, University of Durham",
        "content": "Religious Studies or Education is more than just a Mandatory GCSE subject &#8211; its a look into our past Tuesday 16th May KS3 Have you ever wondered why you have to study RE in school? In this broadcast, we hear from historian Prof. Alec Ryrie who talks to us about the importance of RE and [&hellip;]",
        "link": "http://localhost:8888/new-site/2023/05/26/why-study-re-with-alec-ryrie-professor-of-the-history-of-christianity-university-of-durham/",
        "catagory": "vtalk"
    },
    {
        "value": 957,
        "label": "Engineering In Art With Dr Zoe Laughlin, Director, Institute of Making, UCL",
        "content": "I love having agency in my environment and world wide &#8211; thinking about materials differently Monday 22nd May KS3-5 / S1-6 Artist and designer, Dr Zoe Laughlin was diagnosed with dyslexia at a young age and found the academic side of school difficult. She fully believes in perseverance, persistence, creativity, and following your gut to [&hellip;]",
        "link": "http://localhost:8888/new-site/2023/05/26/engineering-in-art-with-dr-zoe-laughlin-director-institute-of-making-ucl/",
        "catagory": "vtalk"
    },
    {
        "value": 372,
        "label": "Test",
        "content": "",
        "image": "http://localhost:8888/new-site/wp-content/uploads/2023/03/250320231679738119.jpeg",
        "link": "http://localhost:8888/new-site/2023/03/23/test/",
        "catagory": "Uncategorised"
    },
    {
        "value": 1,
        "label": "Hello world!",
        "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Iaculis eu non diam phasellus. Sollicitudin nibh sit amet commodo nulla facilisi nullam. Faucibus scelerisque eleifend donec pretium vulputate sapien nec. Vulputate sapien nec sagittis aliquam malesuada. Justo donec enim diam vulputate ut pharetra. Volutpat ac [&hellip;]",
        "image": "http://localhost:8888/new-site/wp-content/uploads/2023/03/buddhist-wheel.png",
        "link": "http://localhost:8888/new-site/2023/03/03/hello-world/",
        "catagory": "Uncategorised"
    }
]

Here is my loop

    function myLoop(){
        const theArray = newArray;
        for (var i=0; i < theArray.length; i++) {
            return(
            <div class="blog-stamp">
                            <img class="stamp-image" src={theArray[i].image} width="200" height="200" />
                            <RichText
                                tagName="h3"
                                class="stamp-title"
                                onChange={(heading) => upadateMenuItems(src, heading, para, href)}
                                value={theArray[i].label}
                            />
                            <RichText
                                tagName="p"
                                class="stamp-excerpt"
                                onChange={(para) => upadateMenuItems(src, heading, para, href)}
                                value={theArray[i].content}
                            />
                            <p class="button-parent">
                                <a
                                    href={theArray[i].link}
                                    className="sfs-button"
                                    style={{ backgroundColor: backgroundColor, color: textColor }}
                                >
                                    {'Read more'}
                                </a>
                            </p>
                        </div>)
        }
    }

I am a bit confused as the for loop should loop through the whole array and return all the values. Instead it only returns 1 record then quits.

Here is where I call the function in my js file.

<div class="blog-stamp-parent">
            {
                myLoop()
            }
            </div>

I am a newbie so please be kind. Thanks in advance.

How to reduce memory footprint of V8 Isolates?

I have a C++ application using the V8 library that runs JavaScript+WASM code (say, xyz.js) generated by Emscripten compiler. If I run an infinite loop (for (;;) {}) in V8 and measure memory footprint of each additional isolate running in its own thread, it comes to be around 1.1 MiB.

However, if I run xyz.js, the memory footprint is around 40 MiB. The JavaScript part of xyz.js is around 200 KiB, and the WASM part (encoded in base64) is around 800 KiB. It doesn’t seem normal for such small code to compile into dozens of megabytes.

The C++ code is very similar to the V8 Hello World sample with minor refactoring.

Is there any way to reduce the memory footprint of Isolates? I tried disabling the JIT but that also disabled WASM support.

do unbundled files get downloaded when we load the first page of our site or not?

so I’m trying to figure out between bundled and unbundled files difference, so I was reading on different forums and question on stackoverflow and bottom line of them was in bundled version of files, the bundled file gets downloaded first our first page gets loaded and that cause a slower load of the first page because we are downloading the whole code of the website and not that specific page(because of bunding all of our files) and faster load of other pages ( because we have downloaded the whole page code and now they’re cached the other pages load faster).

in the other hand, in unbundled version we have faster first page load because we’re only downloading that specific page code and not the whole website but slower other pages load( because we hadn’t downloaded the whole site code earlier therefore, they’re not cached).

so based on these logics, in unbundled version of files we download each file whenever we request them or use them , but when I opened my project I saw all of them are downloaded in network section of my chrome devtools(actually they appeared after a reload, and I don’t why these file show up after a reload and not on the first attempt?).

so basically I’m wondering, when we have unbundled files, do files get downloaded when we first load the fist page or start our website or each file gets downloaded whenever request or use them?

and is it true that bundled version of files give heavier and slower load of the first page of the websites comparing to a website with unbundled files because like don’t they get minified and compressed so I think there shouldn’t be any difference between them after all?

image of chrome dev tools comparing bundled version and unbundled version of files on first page load:

unbundled:

enter image description here

bundled:

enter image description here

p.n: I have just bundled my js files.

Flash Message Not Showing Up Sveltekit

I am experiencing problems showing flash messages in my application, the problem is that, following a form submit, after the server has handled the request, wanting to do a redirect with a flash message this is not shown. Currently the only flash that works is the login & registration flash, while other actions flash does not show up, here are some code snippets to clarify:

srcroutes+layout.svelte

<script lang="ts">
    import '../app.css';
    import { setupViewTransition } from 'sveltekit-view-transition';
    import { Navbar, Footer } from '$lib/components/layout/';
    import { getFlash } from 'sveltekit-flash-message';
    import { Toaster, toast } from 'svelte-sonner';
    import { MetaTags } from 'svelte-meta-tags';
    import { page } from '$app/stores';
    import extend from 'just-extend';

    export let data;

    const flash = getFlash(page);
    const toastTypes = {
        error: toast.error,
        success: toast.success,
        info: toast.info,
        warning: toast.warning
    };

    $: if ($flash && toastTypes[$flash.type]) {
        toastTypes[$flash.type]($flash.message);
    }

    setupViewTransition();

    $: metaTags = extend(true, {}, data.baseMetaTags, $page.data.pageMetaTags);
</script>

<MetaTags {...metaTags} />

<Toaster richColors closeButton position={'top-center'} />

<div class="flex flex-col h-screen">
    <Navbar />
    <div class="grow">
        <slot />
    </div>
    <Footer />
</div>

srcroutesauthlogin+page.svelte

<script lang="ts">
    import type { PageData } from './$types';
    import { UserLoginZodSchema } from '$validations/UserLoginZodSchema';
    import { InputField, SubmitButton } from '$components/form/';
    import { superForm } from 'sveltekit-superforms/client';
    import { toast } from 'svelte-sonner';
    import { route } from '$lib/ROUTES';

    export let data: PageData;

    let isLoading: boolean;

    const { enhance, form, errors, message } = superForm(data.userLoginFormData, {
        resetForm: true,
        taintedMessage: null,
        validators: UserLoginZodSchema,

        onUpdate: () => {
            isLoading = false;
            if (!$message) return;

            const { alertType, alertText } = $message;

            if (alertType === 'error') {
                toast.error(alertText);
            }
        }
    });
</script>


    <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
        <form
            class="space-y-6"
            method="post"
            on:submit={() => (isLoading = true)}
            use:enhance
            action={route('logInUser /auth/login')}
        >
            <InputField
                type="email"
                name="email"
                label="E-mail"
                placeholder="Endereço de e-mail"
                bind:value={$form.email}
                errorMessage={$errors.email}
            />

            <InputField
                type="password"
                name="password"
                label="Senha"
                placeholder="Criar senha"
                bind:value={$form.password}
                errorMessage={$errors.password}
            />

            <SubmitButton showSpinner={isLoading}>Fazer Login</SubmitButton>
        </form>
    </div>

srcroutesauthlogin+page.server.ts

import type { Actions, PageServerLoad } from './$types';
import type { AlertMessageType } from '$lib/types';
import { message, setError, superValidate } from 'sveltekit-superforms/server';
import { UserLoginZodSchema } from '$validations/UserLoginZodSchema';
import { setFlash } from 'sveltekit-flash-message/server';
import { getUserByEmail } from '$lib/server/data/users';
import { DASHBOARD_ROUTE } from '$lib/appRoutes';
import { Argon2id } from 'oslo/password';
import { lucia } from '$lib/server/auth';
import { redirect } from '@sveltejs/kit';
import {
    EMAIL_NOT_REGISTERED_ERROR,
    INACTIVE_ACCOUNT_ERROR,
    INVALID_PASSWORD_ERROR,
    SUCCESSFUL_LOGIN,
    VALIDATION_ERROR
} from '$validations/validationConstants';

export const load = (async () => {
    return {
        userLoginFormData: await superValidate(UserLoginZodSchema)
    };
}) satisfies PageServerLoad;

export const actions: Actions = {
    logInUser: async ({ request, cookies }) => {
        // Validate the form
        const userLoginFormData = await superValidate<typeof UserLoginZodSchema, AlertMessageType>(
            request,
            UserLoginZodSchema
        );
        // IF the form isn't valid send error message
        if (userLoginFormData.valid === false) {
            return message(userLoginFormData, {
                alertType: 'error',
                alertText: VALIDATION_ERROR
            });
        }
        // Get if the user does exist in the db
        const existingUser = await getUserByEmail(userLoginFormData.data.email);

        if (existingUser === undefined) {
            return setError(userLoginFormData, 'email', EMAIL_NOT_REGISTERED_ERROR);
        }

        const validPassword = await new Argon2id().verify(
            existingUser.password,
            userLoginFormData.data.password
        );

        if (!existingUser.isActive) {
            return setError(userLoginFormData, 'email', INACTIVE_ACCOUNT_ERROR);
        }

        if (!validPassword) {
            return setError(userLoginFormData, 'password', INVALID_PASSWORD_ERROR);
        }

        const session = await lucia.createSession(existingUser.id, {});
        const sessionCookie = lucia.createSessionCookie(session.id);

        cookies.set(sessionCookie.name, sessionCookie.value, {
            path: '.',
            ...sessionCookie.attributes
        });

        // Show a success toast
        setFlash({ type: 'success', message: SUCCESSFUL_LOGIN }, cookies);

        throw redirect(303, DASHBOARD_ROUTE);
    }
};

While this action, for example, does not show the flash after the redirect, the load redirect does not show it either, despite the fact that it was supposed to show an error toast:

srcroutesdashboard+page.server.ts

import type { Actions, PageServerLoad } from './$types';
import { redirect, setFlash } from 'sveltekit-flash-message/server';
import { getAllUsers } from '$lib/server/data/users';
import { LOGIN_ROUTE } from '$lib/appRoutes';
import { lucia } from '$lib/server/auth';
import { error } from '@sveltejs/kit';
import {
    NOT_LOGGED_DASHBOARD_ERROR_MESSAGE,
    NO_ACCOUNT_LOGOUT_ERROR,
    SUCCESSFUL_LOGOUT
} from '$validations/validationConstants';

export const load = (async ({ locals: { user }, cookies }) => {
    if (!user) {
        throw redirect(
            LOGIN_ROUTE,
            {
                type: 'error',
                message: NOT_LOGGED_DASHBOARD_ERROR_MESSAGE
            },
            cookies
        );
    }

    ...
}) satisfies PageServerLoad;

export const actions: Actions = {
    logout: async ({ cookies, locals }) => {
        if (!locals.session?.id) throw error(403, NO_ACCOUNT_LOGOUT_ERROR);

        await lucia.invalidateSession(locals.session.id);

        const sessionCookie = lucia.createBlankSessionCookie();

        cookies.set(sessionCookie.name, sessionCookie.value, {
            path: '.',
            ...sessionCookie.attributes
        });

        // Show a info toast
        setFlash({ type: 'error', message: SUCCESSFUL_LOGOUT }, cookies);

        throw redirect(303, LOGIN_ROUTE);
    }
};