Why is my input value not changing when I type

The input value doesn’t change when a user types
The input is supposed to retain the previous value the user inputted which is saved to the redux state. The useEffect checks for this value and if there’s none it sets it to a number.
My problem now is that it’s not letting me input any value when I type.

export const TrackDetails = () => {
  const [itemNumber, setItemNumber] = useState<number>(0);
  const track = useSelector(selectTempTrackDetails);
  const dispatch = useDispatch();

  const handleNumChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    const newValue = Number(e.currentTarget.value);
    setItemNumber(newValue);
    dispatch(
      setTempTrackDetails({
        updates: { trackNumber: newValue },
      })
    );
  };

  useEffect(() => {
    setItemNumber(track.trackNumber ?? 0);
  }, [track.trackNumber]);

  return (
      <Stack>
        <label htmlFor="secondary-language" className={styles.tracklabel}>
          Track No
          <TooltipImage
            src="/images/Dashboard/required.svg"
            alt="info-icon"
            tooltipLabel="Enter the track No"
          />
        </label>
        <input
          type="number"
          name=""
          id="Track No"
          className={styles.tracktextinput1}
          value={itemNumber}
          onChange={(e) => {
            handleNumChange(e);
          }}
        />
      </Stack>

Vite Vanilla JavaScript [closed]

I started an E-commerce project using just HTML, Tailwind CSS and JavaScript, so I later transfered the project to Vite so I can build a firebase authentication with module, after that I find out that When I deployed on vercel, the landing page is displaying but other pages are not. What could be the problem please. I have tried the Vite Multi page, yet it is still not working

I have tried out using A JavaScript plugins named Page.js, yet it is not working

How to exclude json file from my webpack bundle?

I build my project with wepback, but cant seem to exclude my json file from it.

I am using node.js and trying to store the path of the json file like this, and this codeblock is inside my index.js file.

const users = require('./users.json')
console.log(users)

Inside the webpack.config.js i am trying to exclude that file.

externals: {
"./users.json": "./users.json"
}

However it doesnt really work. I expect my bundle to exclude the json file so i can access it through my index.js file.

Anyone can help me out here?

Create stacking windows desktop notifications from chrome website

I have a larger scale site that I would implement this on, but for simplicity I have a basic html web page that has 2 buttons that push down a notification to the windows desktop. These appear in the banner one at a time. If you click both buttons, only a single notification appears with the last button clicked being the latest notification shown.

In the action centre these show up as multiple notifications all stacked on one another.

Is there a way to have both notifications, shown at the same time in the banner (on ontop of the other). I have looked everywhere for a solution and have found nothing, is this something that can be fixed via the javascript or is it a limitation of windows desktop notifications?

Currently hosting the site on Netlify so I do get the notifications etc.

<body>
    <h1>Notification Tester</h1>
    <button id="btn1">Notification 1</button>
    <button id="btn2">Notification 2</button>
    
    <script>
        // Function to show notifications
        function showNotification(title, body) {
            // Request permission if not already granted
            Notification.requestPermission().then((permission) => {
                if (permission === "granted") {
                    // Create a new notification
                    new Notification(title, {
                        body: body,
                        icon: "https://static.vecteezy.com/system/resources/previews/030/762/552/non_2x/3d-message-notification-bell-icon-illustration-png.png"
                    });
                }
            });
        }
    
        // Add click event listeners to the buttons
        document.getElementById("btn1").addEventListener("click", () => {
            showNotification("Test 1", "This is test 1 notification");
        });
    
        document.getElementById("btn2").addEventListener("click", () => {
            showNotification("Test 2", "This is test 2 notification");
        });
    </script>

How to expand one column width while other column shrinks in css grid layout?

I created a side navigation bar and a main content area. I arranged these in a grid layout using display: grid with columns set to 200px. I also wrote a JavaScript script to toggle the class list. When I click the toggle button, the side navigation shrinks, but the main content area maintains the same width. How can I make the main content area fill the full width?

function toggleSidebar() {
    const sidebar = document.querySelector('.sidebar');
    sidebar.classList.toggle('shrink');
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    height: 100vh;
}

.container {
    display: grid;
    grid-template-columns: 200px minmax(0,1fr); /* Sidebar takes 200px, main content takes remaining space */
    height: 100%;
    grid-template-rows: 1fr; /* Only one row for this layout */
}

.sidebar {
    background-color: #333;
    color: white;
    padding: 15px;
    overflow: hidden;
    transition: width 0.3s ease-in-out; /* Transition effect for shrinking */
}

.sidebar ul {
    list-style-type: none;
}

.sidebar ul li {
    margin-bottom: 10px;
}

.sidebar ul li a {
    color: white;
    text-decoration: none;
}

.main-content {
    background-color: red;
    padding: 20px;
    overflow: auto;
}

.sidebar.shrink {
    width: 50px; /* Shrinks the sidebar width to 50px */
}

.sidebar.shrink ul {
    display: none; /* Hide the links when the sidebar is shrunk */
}

.main-content {
    transition: margin-left 0.3s ease-in-out; /* Adjust content area when sidebar shrinks */
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Grid Layout</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
   <button onclick="toggleSidebar()">Toggle Sidebar</button>
    <div class="container">
        <nav class="sidebar">
            <!-- Side Navigation Content -->
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Services</a></li>
                <li><a href="#">Contact</a></li>
            </ul>
        </nav>
        <main class="main-content">
            <!-- Main Content Area -->
            <h1>Welcome to the main content area</h1>
            <p>This area should adjust its size based on the sidebar.</p>
        </main>
    </div>
 

</body>
</html>

webpack-dev-server WebSocket error: read ECONNRESET at TCP.onStreamRead

I’m facing this problem for a websocket proxy ws/**:

<i> [webpack-dev-server] [HPM] Upgrading to WebSocket
<e> [webpack-dev-server] [HPM] WebSocket error: Error: read ECONNRESET
<e>     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
<e>   errno: -4077,
<e>   code: 'ECONNRESET',
<e>   syscall: 'read'
<e> }

I have attached my configuration and package versions at the very bottom.

Originally migrated webpack from version 4 to version 5. This problem was not observed in version 4. Even now, switching to the old version of the project, this error does not occur when working with the /ws/** socket.

The web socket itself receives data normally, but the IDE console displays this error every time I interact with the web socket. I tried:

  • add fields webSocketTransport, webSocketURL and webSocketServer
  • update webpack packages to the latest versions
  • directly install the ws package of the latest version

Packages versions:

"webpack": "^5.89.0",
"webpack-bundle-analyzer": "^4.10.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"html-webpack-plugin": "^5.6.0",

Webpack configuration:

"use strict";

const webpack = require("webpack");
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CspHtmlWebpackPlugin = require("csp-html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { DefinePlugin } = require('webpack');

const Xliff2Json = require("./Xliff2Json");

const ip = require("ip");
const DEV_IP_ADDR = ip.address();
const DEV_PORT = 5002;
const ASSET_PATH = process.env.ASSET_PATH || "/";
const API_DOMAIN = "";
const API_PORT = "";

const isDevelopment = process.argv[process.argv.indexOf('--mode') + 1] === 'development';

const webpackConfig = {
    entry: ["@babel/polyfill", "./src/index.jsx"],
    output: {
        filename: isDevelopment ? "[name].bundle.js" : "[contenthash].bundle.js",
        path: path.resolve(__dirname, "dist"),
        publicPath: "/",
        library: "app",
    },
    devServer: {
        port: DEV_PORT,
        host: DEV_IP_ADDR,
        historyApiFallback: true,
        devMiddleware: {
            publicPath: ASSET_PATH,
            stats: "minimal",
        },
        client: {
            logging: "info",
            overlay: {
                errors: true,
                warnings: false,
                runtimeErrors: true,
            },
            webSocketTransport: 'ws',
            webSocketURL: `ws://${DEV_IP_ADDR}:${DEV_PORT}/ws`,
        },
        webSocketServer: 'ws',
        static: {
            directory: path.join(__dirname, "dist"),
        },
        open: true,
        hot: true,
        liveReload: true,
        proxy: [
            {
                context: [
                    "/api/**",
                    "/stream/sse/**",
                    "/download/**"
                ],
                target: "https://my-instance.com",
                secure: false,
                changeOrigin: true,
            },
            {
                context: [
                    "/ws/**",
                    "/stream/ws/**"
                ],
                target: "wss://my-instance.com",
                ws: true,
                secure: false,
                changeOrigin: true,
            },
        ],
    },
    module: {
        rules: [
            {
                test: /.(css|scss)$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    "css-loader",
                    "postcss-loader",
                    "sass-loader"
                ],
            },
            {
                test: /.(jsx|js)$/,
                exclude: /(node_modules)/,
                use: {
                    loader: "babel-loader",
                },
            },
            {
                test: /.(png|svg|jpg|gif|woff|woff2|eot|ttf|otf)$/,
                type: 'asset/resource',
            }
        ],
    },
    resolve: {
        extensions: [".js", ".jsx"],
    },
    plugins: [
        new webpack.ProgressPlugin(),
        new CleanWebpackPlugin(),
        new MiniCssExtractPlugin({
            filename: "[name].css",
            chunkFilename: isDevelopment ? "[id].css" : "[contenthash].css",
            ignoreOrder: true
        }),
        new HtmlWebpackPlugin({
            inject: true,
            hash: true,
            favicon: "./src/static/images/favicon.png",
            template: "./src/index.html",
            filename: "index.html",
        }),
        new DefinePlugin({
            API_DOMAIN: `"${API_DOMAIN}"`,
            API_PORT: `"${API_PORT}"`,
        }),
        new CspHtmlWebpackPlugin(
            {
                "default-src": ["'self'", "my-sentry-backend.com", "wss:", "ws:"],
                "base-uri": "'self'",
                "object-src": "'none'",
                "frame-src": "'none'",
                "worker-src": "blob:",
                "img-src": ["'self'", "data:"],
                "script-src": ["'self'", "'unsafe-eval'"],
                "style-src": ["'unsafe-inline'", "'self'"],
            },
            {
                enabled: true,
                hashingMethod: "sha256",
                hashEnabled: {
                    "worker-src": true,
                    "script-src": true,
                    "style-src": true,
                },
                nonceEnabled: {
                    "worker-src": true,
                    "script-src": true,
                    "style-src": false,
                },
            }
        )
    ],
};

if (isDevelopment) {
    webpackConfig.devtool = 'inline-cheap-module-source-map';
}

module.exports = webpackConfig;

How to pass component as a prop so that the passed component doesn’t initialize with every re render?

I am trying to use a legacy class component (I can’t modify it) that goes like this:

class LegacyComponent {
    render() {
        const {
            customComponent: CustomComponent,
        } = this.props;

        return (
            <div>
                    {CustomComponent ? (
                        <CustomComponent />
...

Inside my functional component I want to pass a component with props to this legacy component, let’s say

<MyCustomComponent prop1={prop1} prop2={prop2}>

When I try to do it like this:

<LegacyComponent customComponent={<MyCustomComponent prop1={prop1} prop2={prop2}>}/>

it will not work and throw an error Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object..

On the other hand when I would use a function like this:

<LegacyComponent customComponent={() => <MyCustomComponent prop1={prop1} prop2={prop2}>}/>

it would technically work, but the component would render from scratch (reinitialize) every time my parent component rerenders.

I thought about using memo or useCallback, but whenever the dependencies change the component is also reinitialized from scratch so that is not working.

How can I make LegacyComponent naturally rerender with props changed instead of being reinitialized / rendered every time parent component rerenders?

How do you create a responsive design using CSS? [closed]

Creating a responsive design using CSS involves using various techniques to make your website layout adapt to different screen sizes, devices, and orientations. Here’s a step-by-step guide:

  1. Use a Mobile-First Approach
    Start by designing for small screens (mobile devices) and then work your way up to larger screens. This approach ensures that your design is optimized for the majority of users.

  2. Use Flexible Units
    Instead of using fixed units like pixels, use flexible units like:

  • % (percentages)
  • em
  • rem
  • vw (viewport width)
  • vh (viewport height)
  1. Define Breakpoints
    Breakpoints are specific screen sizes where your design changes. Common breakpoints include:
  • Mobile: 320px – 480px
  • Tablet: 481px – 768px
  • Desktop: 769px – 1024px
  • Large Desktop: 1025px and above
  1. Use Media Queries
    Media queries allow you to apply different styles based on specific conditions, such as screen size. Use the @media rule to define your breakpoints:
@media only screen and (max-width: 768px) {
  /* styles for tablet and below */
}

@media only screen and (min-width: 769px) and (max-width: 1024px) {
  /* styles for desktop */
}
  1. Use Flexbox and Grid
    Flexbox and Grid are powerful layout tools that can help you create responsive designs. They allow you to easily manage layout, alignment, and spacing.

  2. Test and Iterate
    Test your design on different devices, screen sizes, and orientations. Iterate on your design until it looks and works great everywhere.

Example Use Case
Suppose you want to create a responsive navigation menu that changes layout based on screen size. Here’s an example using media queries and flexbox:

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

@media only screen and (max-width: 768px) {
  nav {
    flex-direction: column;
  }
}

This code creates a navigation menu that displays horizontally on large screens and vertically on small screens.

Additional Resources

  • Mozilla Developer Network: (link unavailable)
  • W3Schools: (link unavailable)
  • CSS-Tricks: (link unavailable)

It is a very responsive designs for the programmers

way to stop moving markers in maplibre in react

i got an problem using maplibre in react. i have an component for map that contains several places. when i move map i can see my places with exact lat and lng. but when i zoom in or out the markers will move in the map. how can i make them fully fixed in their places?

/* eslint-disable no-unused-expressions */

// import Map, { Marker } from "react-map-gl";
import React, { useMemo, useState } from "react";
import {
Map,
Marker,
} from "@vis.gl/react-maplibre";
const UserSearchMap = () => {
// Map's center coordinates
const [mapCenterLat, setMapCenterLat] = useState<number>(99.25244867437764);
const [mapCenterLng, setMapCenterLng] = useState<number>(32.16723991017331);
// Define fixed markers with constant coordinates
const markers = [
{ lat: 32.25244867437764, lng: 99.16723991017331, content: "Marker 1" },
{ lat: 37.25344867437764, lng: 5.16913991017331, content: "Marker 2" },
{ lat: 1.25144867437764, lng: 34.16513991017331, content: "Marker 3" },
];

// Update the map center when the user pans or zooms the map

const pins = useMemo(
() =>
  markers.map((city: any, index: number) => (
    <Marker
      key={`marker-${index}`}
      longitude={city.lng}
      latitude={city.lat}
      anchor="center"
    >
      <div className="text-primary-400 w-2">ss</div>
    </Marker>
  )),
[]
);

return (
<div className="flex w-[360px] h-[590px] relative m-10">
  <Map
  onZ
    // onMove={handleMapMove}
    initialViewState={{
      latitude: mapCenterLat, // Map's initial center latitude
      longitude: mapCenterLng, // Map's initial center longitude
      zoom: 15,
      bearing: 0,
      pitch: 0,
    }}
    mapStyle="https://api.maptiler.com/maps/streets/style.json?key=myKey"
    >
    {pins}
  </Map>
</div>
);
};

export default UserSearchMap;

How to implement smooth text expansion and truncation with transition in React?

I’m working on a React component where I need to show an award message that can expand and collapse based on user interaction. The goal is to smoothly expand the content when the user clicks “Read More” and smoothly collapse it when they click “Read Less”. Additionally, the content should be truncated when collapsed.

However, I’m running into an issue with applying smooth transitions while toggling between the expanded and collapsed states. Here’s what I’m trying to achieve:

When the content is collapsed:
The content should be truncated (using line-clamp or similar).
The height should be animated to make it look smooth when collapsing.
When the content is expanded:
The height of the content should expand smoothly to show the full message.
The truncation should be removed and the full message should be visible.
Problem:
The main issue I’m facing is that the text is getting truncated immediately, even before the collapse transition happens, and the transition itself isn’t smooth.

I’ve tried using -webkit-line-clamp and max-height, but it doesn’t seem to work as expected, and the truncation happens too abruptly.

Here’s the code I’ve tried so far:
tsx

`

export const Ellipsis = (textLineAmounts: number) => css`
    display: -webkit-box;
    display: -moz-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    -webkit-line-clamp: ${textLineAmounts};
    -moz-line-clamp: ${textLineAmounts};
`;

export const ExpandableBodyRow = styled.div<BodyRowProps>`
    box-sizing: border-box;
    display: flex;
    max-height: ${props => (props.expanded ? `2000px` : `75px`)};
    margin: ${({ theme }) => `0 ${theme.space.single}px ${theme.space.double}px`};
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
`;

interface AwardMessageProps {
    isTruncated: boolean;
}

export const AwardMessage = styled.div<AwardMessageProps>`
    ${({ isTruncated }) => isTruncated && Ellipsis(3)}
    color: ${({ theme }) => theme.color.default.primaryText};
`;

`
For the container holding the body, I allow dynamic expansion:

tsx

Then, in the component:

    const standardAward: JSX.Element = (
        <>
            <SC.ExpandableBodyRow expanded={expanded}>
                {award?.awardMessage 
                    <SC.AwardMessage isTruncated={!expanded}>
                        <p
                            ref={messageTextRef}
                            tabIndex={-1}
                        >
                            {award?.awardMessage}
                        </p>
                    </SC.AwardMessage>
                }
            </SC.ExpandableBodyRow>
            {!isRestrictedAward && isTruncated && (
                <SC.ReadMoreRow>
                    {award?.awardMessage && (
                        <button
                            onClick={clickHandler}
                        >
                            {expandButtonText}
                        </button>
                    )}
                </SC.ReadMoreRow>
            )}
        </>
    );

What I’ve tried:Using -webkit-line-clamp for truncation – This does not transition smoothly when expanding or collapsing.Using max-height for smooth height transition – This works for the height transition but doesn’t handle truncation smoothly.JavaScript-based dynamic truncation – But the truncation happens too quickly, causing a jump.Desired behavior:Smooth expansion and collapse.Truncation only applies when collapsed.Avoid abrupt changes when toggling between expanded and collapsed.I would really appreciate any suggestions or examples on how to implement smooth transitions for both the expansion and truncation of the content.

Thanks in advance!

Print GMT+13:00 in Luxon [closed]

I’m able to print GMT+ in moment:

formatDate(dateString: string): string {
    return moment(dateString).format('ddd MMM DD YYYY HH:mm:ss [GMT]Z');
}
// Output: Thu Jan 09 2025 23:20:46 GMT+13:00

But not able to print with Luxon:

 formatDate(dateString: string): string {
    return DateTime.fromISO(dateString).toFormat('ccc MMM dd yyyy HH:mm:ss [GMT]ZZ');
}
// Output: Thu Jan 09 2025 23:20:46 [AD123:20]+13:00

Issue with adding SearchBuilder to Datatables js

I am trying to add searchBuilder to my Datatables Js:

the head

  <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
    
    <!-- DataTables CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css">
    
    <!-- jQuery, DataTables JS and Plotly -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js"></script>
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>

    <!-- SearchBuilder CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/2.2.0/css/dataTables.dataTables.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/searchbuilder/1.8.1/css/searchBuilder.dataTables.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/datetime/1.5.4/css/dataTables.dateTime.min.css">
    <!-- SearchBuilder JS -->
    <script src="https://cdn.datatables.net/searchbuilder/1.8.1/js/dataTables.searchBuilder.js"></script>
    <script src="https://cdn.datatables.net/searchbuilder/1.8.1/js/searchBuilder.dataTables.js"></script>
    <script src="https://cdn.datatables.net/datetime/1.5.4/js/dataTables.dateTime.min.js"></script>

the table:

<div class="row mt-5">
            <div class="col-12">
                <h5>Attendance Report by Employee for {{ selected_month }}</h5>
                <table id="attendanceTable" class="table table-striped table-hover">
                    <thead>
                        <tr><th>Full Name</th><th>Attendance Count</th></tr>
                    </thead>
                    <tbody>
                        {% for index, row in attendance_data.iterrows() %}
                        <tr><td>{{ row['Assignee Name'] }}</td><td>{{ row['Attendance Count'] }}</td></tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>

the initialisation

$(document).ready(function() {
            // Attendance DataTable with SearchBuilder
            new DataTable('#attendanceTable', {
                "pageLength": 10,
                "order": [[1, "desc"]],
                layout: {
                    top1: 'searchBuilder'  // Adding the SearchBuilder feature
                }
            });

        });

Followed the docs but the searchbuilder never shows up. Please can you point me to what I am not doing correctly.

How to use Chart.js in a content script (content.js) for a Google Chrome extension to inject into an existing website?

I’m working on a Google Chrome extension and I want to inject a Chart.js chart into an existing website. I have the following scenario:

  1. I need to use Chart.js to render a chart dynamically.

  2. The chart
    should be injected into the current page via the content.js script
    of my Chrome extension.

  3. The target website does not have Chart.js,
    so I need to load it via my extension and inject the chart into the
    page.

Here’s my setup:

  • Manifest version 3
  • The extension uses a content script (content.js).
  • The content script is supposed to run on a specific website, and I
    want to add the chart after the page loads.

What I’ve tried so far:

Using chrome.scripting.executeScript to inject the Chart.js script into the page.
Trying to create a element within content.js and then render the chart.
However, I’m encountering issues with:

  • Properly loading the Chart.js library in the content script.
  • Ensuring the canvas is rendered correctly on the webpage.
  • Handling dependencies between the content script and Chart.js.

How can I load Chart.js in a content script and inject it into an existing webpage without causing conflicts?

React “The node to be removed is not a child of this node” on hot refresh

I was browsing similar errors but I can’t quite solve my problem. When I change something in code (for example add span somewhere) React hot refreshes it all. But in most of such cases after refresh I get blank screen and errors in console:

 Uncaught DOMException: Node.removeChild: The node to be removed is not a child of this node
    scheduleRefresh <anonymous code>:1
    performReactRefresh @react-refresh:267
....

The above error occurred in the <LoadingPage> component:

LoadingPage@http://localhost:5173/src/pages/util/LoadingPage.tsx?t=1736415967744:19:21
SecuredProvider@http://localhost:5173/src/contexts/SecuredContext.tsx?t=1736416513019:28:25
RenderedRoute@http://localhost:5173/node_modules/.vite/deps/chunk-SG3ZZ57O.js?v=2df0fbbc:4072:7
....

I have also similar code that sometimes also throws errors (only by Contexts!) but lets focus on SecuredProvider
LoadingPage.tsx:

interface Props {
    text?: string;
}

const LoadingPage: FunctionComponent<Props> = ({text}) => {
    return (
        <div className={'page-loading'} key={'page-loading'}>
            <Spinner/>
            {text && <span className={'loading-text'}>{text}</span>}
        </div>
    );
};

export default LoadingPage; // <------------ HERE THROWS ERROR, AT THE END OF THE FILE

and SecuredProvider.tsx

interface SecuredContextProvider {
    children: ReactNode;
    admin?: boolean;
}

type Props = SecuredContextProvider;

export interface SecuredContextProps {
    session: SessionData;
}

const SecuredContext = createContext<SecuredContextProps | null>(null);

export function useSecured() {
    return useContext(SecuredContext) || {} as SecuredContextProps;
}

const SecuredProvider: FunctionComponent<Props> = ({children, admin = false}) => {
    const {session, sessionLoading} = useAuth();

    if (session === undefined) {
        return <LoadingPage key={'loading-secured'} text={"Uwierzytelniane..."}/> // <-------- HERE THROWS ERROR
    }

    if (!session || (admin && !session.session.user.is_admin)) {
        return <ErrorPage errorCode={404} errorTitle={"Nie znaleziono strony"}
                          errorTip={"Upewnij się, że wpisałeś dobry adres i spróbuj ponownie."}/>
    }

    const contextProps: SecuredContextProps = {
        session
    }

    return (
        <SecuredContext.Provider value={contextProps}>
            {children}
        </SecuredContext.Provider>
    );
};

export default SecuredProvider;

I even debugged if session is undefined during that crash and it was always set. (console.log above if)
I have no idea at all what’s happening here, but it’s really tiring during development as I have to refresh whole page after even smallest change. It’s so simple code and it breaks?!