New to coding: SyntaxError when implementing React components in VS code with JS, how can I resolve this issue?

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.js';

const root = ReactDOM.createRoot(document.getElementById('root'));

const element = <React.StrictMode> <app /> </React.StrictMode>


root.render(element);

I am writing my code using JS in VS code, it is showing me a syntax error when trying to implement react components. what do I do? I am new to coding and this is my first project, please explain any solutions in details. Thanks, in advance.

I have already tried many methods that I could find on here. but none of them seem to work. such as converting my index.js file to index.jsx and many others.

Content Security Policy (CSP) blocking my local script

I’m creating a website as a personal project and I preview the website through live preview in VSCode. I added the CSP meta tag in the header section of the html document like this:

<meta http-equiv="Content-Security-Policy" content="script-src 'self'">

I have a simple javascript file in the same directory as the html document, which runs a script that changes some css-style on my website. The way I understand “script-src ‘self'” is that it should allow my javascript file to be loaded since both the javascript file and html file (and css) have the same origin/directory.

For some reason the script doesn’t work.

I tried removing the CSP meta tag completely, and the script runs fine. So I’m certain that the problem is not due to my markup.

I tried running a debugger, and found nothing wrong.

Maybe I have completely misunderstood the meaning of ‘self’. In that case I would appreciate some enlightenment.

Electron.js has broken encoding and UTF-8 not working

Electron.js coding UTF-8 has broken

The ipcRenderer receives the data correctly. But that’s when it sends already scary characters to the server side. Also, in sequelize, when making requests, it is also not clear what is happening (everything works in models.js, but not in app.js anymore). All file encodings are UTF-8

meta charset=”utf-8″ is in every HTML file

enter image description here

How to setup firebase authentication to a chrome extension?

asking for a step-by-step guide on how to set up firebase authentication on chrome extension to easily add user authentication to my project. The goal is to provide users with a secure way to sign up, sign in, and manage their account information within the chrome extension.

The answer should cover the process of creating a Firebase project, enabling Firebase Authentication, installing the Firebase SDK, initializing Firebase in the Chrome Extension, implementing login functionality, using the Firebase Auth API to authenticate requests to the server, and ensuring secure communication between the Chrome Extension and the server

How to Update user model with patch and react native

I have a react native app and I try to update the user data. Like firstname, lastname, etc.

And I am calling a api call. And I try to update a logged in user through passing arguments in the header of the api call. But apparently that doesn’t work untill now. Only when I pass the arguments hardcoded then it works.

So this is the service:

export const AccountUpdateRequest = async (
    first_name,
    last_name,
    email,
    username,
    password,
    password2
) => {
    const token = await retrieveToken();
    console.log("response");
    try {
        if (token) {
            const response = await fetch("http://192.168.1.65:8000/api/user/me/", {
                method: "PATCH",
                headers: {
                    Authorization: `Token ${token}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                    first_name: first_name,
                    last_name: last_name,
                    email: email,
                    username: username,
                    password: password,
                    password2: password2,
                }),
            });

            return await response.json();
        } else {
            throw new Error(token);
        }
    } catch (error) {
        //console.log(error);
        error("can't retrieve data");
    }
};

And so this doens’t work. But if I pass the properties hardcodes. Like:

    body: JSON.stringify({
                    first_name: "helloThere",
                    last_name: "jooh",
                    email: "[email protected]",
                    username: "username999",
                    password: "1234567890",
                    password2: "1234567890",
                }),

Then it works.

And I have the context:

const UpdateUserProfileRequest = async (
        first_name,
        last_name,
        email,
        username,
        password,
        password2
    ) => {
        setIsLoading(true);
        AccountUpdateRequest(first_name, last_name, email, username, password, password2)
            .then((u) => {
                console.log(u);
                setUser(u);
                setIsLoading(false);
            })
            .catch((e) => {
                setIsLoading(false);
                setError(e.toString());
            });
    };

And the view with the input fields:

export const SetScreen = ({ navigation }) => {
    const [username, setUsername] = useState("");
    const [firstName, setFirstName] = useState("");
    const [lastName, setLastName] = useState("");
    const [email, setEmail] = useState("");
    const [password, setPassword] = useState("");
    const [password2, setPassword2] = useState("");
    const {
        isLoading,
        onLogout,
        error,      
        passwordValidError,
        UpdateUserProfileRequest,
    } = useContext(AuthContext);

    const changedText = (evt) => {
        console.log("changed", firstName);
    };

    useEffect(() => {
        AccountRequest().then((data) => {
            setFirstName(data.first_name);
            setLastName(data.last_name);
            setEmail(data.email);
            setUsername(data.username);
            setPassword(data.password);
            setPassword2(data.password2);
        });
    }, []);

    return (
        <>
            <ScrollView style={styles.scrollView}>
                <AccountBackground>
                    <AccountCover />
                    <Title>Instellingen</Title>
                    <AccountContainer>
                        <AuthInput
                            label="Voornaam"
                            value={firstName}
                            autoCapitalize="none"
                            onChange={changedText}
                            onChangeText={(fn) => setFirstName(fn)}
                        />
                        <Spacer size="large">
                            <AuthInput
                                label="Achternaam"
                                value={lastName}
                                autoCapitalize="none"
                                textContentType="Achternaam"
                                onChangeText={(ln) => setLastName(ln)}
                            />
                        </Spacer>
                        <Spacer size="large">
                            <AuthInput
                                label="E-mail"
                                value={email}
                                textContentType="emailAddress"
                                keyboardType="email-address"
                                autoCapitalize="none"
                                onChangeText={(em) => setEmail(em)}
                            />
                        </Spacer>

                        <Spacer size="large">
                            <AuthInput
                                label="Username"
                                value={username}
                                textContentType="username"
                                keyboardType="username"
                                autoCapitalize="none"
                                onChangeText={(un) => setUsername(un)}
                            />
                        </Spacer>
                        <Spacer size="large">
                            <AuthInput
                                label="Wachtwoord"
                                value={password}
                                textContentType="password"
                                secureTextEntry
                                autoCapitalize="none"
                                onChangeText={(p) => {
                                    setPassword(p);
                                }}
                                error={passwordValidError}
                            />
                        </Spacer>
                        <Spacer size="large">
                            <AuthInput
                                label="Herhaal wachtwoord"
                                value={password2}
                                textContentType="password2"
                                secureTextEntry
                                autoCapitalize="none"
                                onChangeText={(pas) => setPassword2(pas)}
                            />
                        </Spacer>
                        {error && (
                            <ErrorContainer size="large">
                                <Text variant="error">{error}</Text>
                            </ErrorContainer>
                        )}

                        <Spacer size="large">
                            {!isLoading ? (
                                <AuthButton
                                    ion-icon
                                    name="log-out-outline"
                                    mode="contained"
                                    onPress={() => onLogout()}>
                                    uitloggen
                                </AuthButton>
                            ) : (
                                <ActivityIndicator animating={false} />
                            )}
                        </Spacer>
                        <Spacer size="large">
                            <AuthButton icon="email" mode="contained" onPress={() => UpdateUserProfileRequest()}>
                                save
                            </AuthButton>
                        </Spacer>
                    </AccountContainer>
                    <Spacer size="large">
                        <AuthButton mode="contained" onPress={() => navigation.goBack()}>
                            Back
                        </AuthButton>
                    </Spacer>
                </AccountBackground>
            </ScrollView>
        </>
    );
};

Question: how to update the user data with the given parameters?

How can a webserver return a raw JSON object based on the query string?

Background When using a frontend framework, e.g. Angular or Flutter, and put a JSON file is put under the assets folder, calling something like http://localhost:4200/myapp.com/assets/hello.json will retrieve the JSON file as is, without the GUI. That makes me think the web server serving the frontend framework knows how to return a raw JSON object.

Now, instead of a static JSON file, I would like to create a JSON object content so that it will return a dynamic JSON object. For example, http://localhost:4200/echo?input=world will return {“hello”: “world”}. Please note that I don’t want it to be displayed in the GUI, but returned as a raw JSON object.

Use case
I have a 3rd party independent frontend app embed inside a parent Angular app. This 3rd party app is displayed as an Angular component using iFrame. However, this embedded app requires some data for customizing the display for the user dynamically. The way it works is by setting a query string parameter, which returns a JSON object.

Current Approach
This can be done easily with an API endpoint returning a JSON object. But this requires a unnecessary call to the backend because the parent Angular app has already got that information, plus there is a cost incurred to each backend call.

Question How can a web server hosting my Angular app return a raw JSON object based on the query string as the situation described above?

How to stop webpack from executing all the code on first time loading?

I am currently working on a frontend for my backend. In the frontend I am using webpack to bundle my JS files. The only problem is they are instantly getting executed which isn’t good for my application, because I can only execute certain code (vertretungsplan.js) after login. So if I redirect to vertretungsplan.html from login.html after a successful login, I want the vertretungsplan.js code to be excecuted (currently the all the code is instantly getting executed).

webpack.config.js:

import path from 'path';
import {CleanWebpackPlugin} from 'clean-webpack-plugin';

const config = {
    entry: {
        login: './src/js/entry.js',
        vertretungsplan: './src/js/vertretungsplan.js'
    },
    output: {
        filename: '[name].js',
        path: path.resolve(process.cwd(), 'dist'),
    },
    devtool: 'inline-source-map',
    module: {
        rules: [
            {
                test: /.js$/,
                use: ["babel-loader"],
                exclude: /node_modules/
            },
            {
                test: /.js$/,
                use: ["source-map-loader"],
                enforce: "pre",
                exclude: /node_modules/
            },
        ]
    },
    resolve: {
        extensions: ['.js']
    },
    watchOptions: {
        ignored: /node_modules|dist/,
    },
    plugins: [
        new CleanWebpackPlugin()
    ]
};

export default config;

entry.js (for multiple output files because code should not be executed all at once)

import "./login.js";
import "./vertretungsplan.js";

login.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <link href="../styles/main.css" rel="stylesheet" type="text/css">
    <title>Vertretungsplan</title>
</head>
<body>
<form>
    <label for="username">Username:</label>
    <input id="username" name="username" required type="text">
    <br>
    <label for="password">Password:</label>
    <input id="password" name="password" required type="password">
    <br>
    <input id="submit" type="submit" value="Submit">
</form>
<script defer src="../../dist/login.js" type="module"></script>
</body>
</html>

login.js

import axios from "axios";

console.log("Index.js loaded");

const submitBtn = document.getElementById("submit");
submitBtn.addEventListener("click", submit);

function submit(event) {
    event.preventDefault();
    const username = document.getElementById("username").value;
    const password = document.getElementById("password").value;

    login(username, password)
}

function login(username, password) {
    let data = JSON.stringify({
        "username": username,
        "password": password
    });

    let config = {
        method: 'post',
        maxBodyLength: Infinity,
        url: 'http://localhost:8080/api/v1/auth/authenticate',
        headers: {
            'Content-Type': 'application/json'
        },
        data: data
    };

    axios.request(config)
        .then((response) => {
            const jwtToken = response.data.token;
            setCookie("jwt", jwtToken, 7);
            window.location.href = "../pages/vertretungsplan.html";
        })
        .catch((error) => {
            console.log(error);
        });

}

function setCookie(name, value, days) {
    const expires = new Date();
    expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
    document.cookie = `${name}=${value};expires=${expires.toUTCString()};path=/`;
}

vertretungsplan.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <link href="../styles/main.css" rel="stylesheet" type="text/css">
    <title>Vertretungsplan</title>
</head>
<body>
<table id="vertretungsplan">
    <tr id="vertretungsplan-head">
    </tr>
    <tbody id="vertretungsplan-body">
    </tbody>
</table>
</body>
</html>

vertretungsplan.js

import axios from "axios";

console.log("Vertretungsplan.js loaded");

const head = ["Klasse", "Stunde", "Fach", "Art", "Lehrer", "Vertreter"]; // Überschriften der einzelnen Spalten

const vertretungsplanBody = document.getElementById("vertretungsplan-body");
const vertretungsplanHead = document.getElementById("vertretungsplan-head");

function init() {

    let config = {
        method: 'get',
        maxBodyLength: Infinity,
        url: 'http://localhost:8080/api/v1/resources/vertretungsplan'
    };

    axios.request(config)
        .then((response) => {
            let data = response.data;
            head.forEach((item) => {
                vertretungsplanHead.innerHTML += `<th>${item}</th>`;
            });
            data.forEach((eintrag) => {
                const row = document.createElement("tr");
                head.forEach((eigenschaft) => {
                    eigenschaft = eigenschaft.toLowerCase();
                    const cell = document.createElement("td");
                    cell.textContent = eintrag[eigenschaft];
                    row.appendChild(cell);
                });
                vertretungsplanBody.appendChild(row);
            });
        })
        .catch((error) => {
            if (error.response.status === 403) {
                window.location.href = "../pages/login.html";
            }
        });
}

init();

This is the console output on loading the login.html page:

enter image description here

And this is my project hierarchy:

enter image description here

This is my first project like that, so I also have no problem with feedback regarding other things.

Why does Material Symbols font take so long to load and how can I optimize it?

Right now I’m using Material Symbols for my website. It works great! It’s pretty, easy to use and works great with my design. However, I’m noticing that it takes a LONG time to load. Once the *2.7 MB* file finishes loading and gets cached, the website loads pretty fast. I’m loading the file using a CSS import:

@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200');

But loading using an HTML tag is still super slow. It’s taking up to *30 SECONDS* to load those 2.7 MB on the Fast 3G preset. Other fonts (also imported using a CSS import) take at most 500ms to load (under that same 3G preset). Why is Material Symbols taking so long to load? What can I do about it? I know for sure I don’t need all those icons, so how can I only load the icons I need? Or is this normal?

I tried importing the CSS file in other ways, such as an HTML tag, import it using JS and even using the static icon font, instead of the variable one. It’s still taking a lot of time though. Other fonts used to have this issue, and I solved it by removing the Italics because I wasn’t using them. That seems to have fixed the issue. However, AFAIK you can’t do something similar with the Material Symbols font.

I am not able to make a request with sending a file with Cypress

Hello everybody,

Need help. I have an end-point test automation project. Its language is in JavaScript (With the Node/NPM dependency manager) and I use the Cypress and Cucumber tools for the development of test scenarios.

I’m having trouble creating the request function for a specific end-point that requires a file upload. The Curl (with the sensitive information of the company I work for changed) is as follows:

curl --request POST 
  --url https://anydomain.com/v1/upload/file/123/upload_document 
  --header 'Authorization: Bearer 123' 
  --header 'Content-Type: multipart/form-data' 
  --header 'accept: application/json' 
  --cookie dtCookie=dtCookie1234567890 
  --form doc_type=letter_of_attorney 
  --form 'file=@/home/user/repository/automation/back/myProjectCypress/cypress/fixtures/firstTest/image.jpg'

I know it sounds embarrassing, but I tried using chatGPT to help me with this point. The solution he returned to me is this:

cy.fixture('firstTest/image.jpg').then(fileContent => {
  cy.request({
    method: 'POST',
    url: 'https://anydomain.com/v1/upload/file/123/upload_document',
    headers: {
      'Authorization': 'Bearer 123',
      'Content-Type': 'multipart/form-data',
      'accept': 'application/json',
      'Cookie': 'dtCookie=dtCookie1234567890'
    },
    body: {
      doc_type: 'letter_of_attorney',
      file: {
        value: fileContent,
        options: {
          filename: 'image.jpg',
          contentType: 'image/jpeg'
        }
      }
    }
  }).then(response => {
    expect(response.status).to.eq(200)
  })
})

But when executing the proposed solution in my project, the end-point returned status code 400 and the following message in its response body: Missing boundary in multipart.

What is the definitive way for me to make this request, or if the chatGPT gave me the right way, what adjustments should I make to make the request successfully?

Thank you in advance for your attention and I apologize for any grammatical errors, I am Brazilian and my English is terrible.

I tried to make a request with sending a file with Cypress, but I wasn’t successful.

main.js:1 FATAL: Unable to initialize @polkadot/wasm-crypto:: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly in angular

i wanna create an extention for google chrome with agular but when run this extention on google chrome it show me this error :

main.js:1 FATAL: Unable to initialize @polkadot/wasm-crypto:: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module because neither ‘wasm-eval’ nor ‘unsafe-eval’ is an allowed source of script in the following Content Security Policy directive: “script-src ‘self'”

manifest:

{
  "name": "Great Extension",
  "version": "1.0",
  "description": "Build an Extension with Angular",
  "manifest_version": 3,
  "permissions": [
      "activeTab",
      "webNavigation",
      "storage",
      "scripting"
  ],
  "background": {
    "service_worker": "background.js",
    "type": "module"
  },
  "content_security_policy": {
    "extension_pages": "script-src 'self'; object-src 'self'; script-src-elem 'self' 'unsafe-inline' https://music.yandex.ru/;"
},
   "action": {
      "default_popup": "index.html"
  }
}

what the problem ? how can i solve ?

   import { Component } from '@angular/core';
import { ApiPromise, WsProvider } from '@polkadot/api';
import { web3Accounts, web3Enable } from '@polkadot/extension-dapp';
import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
import { Keyring } from '@polkadot/keyring';
import { KeyringPair } from '@polkadot/keyring/types';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  
  walletAddress: string='';
  private account!: KeyringPair;

  constructor() {
    this.checkConnection()
      .then(() => this.createWallet())
      .catch((error) => console.error("An error occurred:", error));
  }
  


  async checkConnection(): Promise<void> {
    await this.connect();
  }

  async connect() {
    const provider = new WsProvider('ws://127.0.0.1:9944');
    const _api = new ApiPromise({ provider });
    await _api.isReady;
   

  }

  async createWallet():Promise<void> {
    
    await cryptoWaitReady();

    const mnemonic = mnemonicGenerate();
    const keyring = new Keyring({ type: 'sr25519' });
    this.account = keyring.addFromUri(mnemonic);
    this.walletAddress = this.account.address;
  } 
}

How to do inline editing with Yajra DataTables in Laravel?

I am trying to implement inline editing using Yajra DataTables in Laravel but I am having some trouble. I have already set up my DataTable and it is displaying my data correctly.

However, I now want to be able to edit the fields inline and save the changes to my database. I have researched on online resources and documentations but I could not seem to figure out how to do it.

If you have any experience with Yajra DataTables and inline editing in Laravel, It would be greatly appreciated if you could share some code or resources that can help me implement this feature. Thank you in advance for your help!

CustomerController.php

public function list(Request $request)
{
    $customers = Customer::orderBy('id', 'desc')->get();

    return DataTables::of($customers)
        ->addIndexColumn()
        ->addColumn('created_at', function ($customer) {
            return $customer->created_at->format('d.m.Y H:i:s');
        })
        ->addColumn('name', function ($customer) {
            return $customer->name;
        })
        ->addColumn('phone', function ($customer) {
            return $customer->phone;
        })
        ->addColumn('status', function ($customer) {
            $btn = '';
            foreach ($customer->statuses as $status) {
                $btn .= '<span><i class="fa fa-circle" aria-hidden="true" style="color: ' . $status->status->color . '"></i> ' . $status->status->title . '</span><br>';
            }
            return $btn;
        })
        ->addColumn('treatment', function ($customer) {
            $btn = '';
            foreach ($customer->treatments as $treatment) {
                $btn .= '<span><i class="fa fa-circle" aria-hidden="true" style="color: ' . $treatment->treatment->color . '"></i> ' . $treatment->treatment->title . '</span><br>';
            }
            return $btn;
        })
        ->addColumn('action', function ($row) {
            $btn = '<a href="' . route('customer.edit', $row) . '" class="btn btn-primary btn-sm">Düzenle</a>';
            $btn .= '<form action="' . route('customer.destroy', $row) . '" method="post" class="d-inline-block">
                    ' . csrf_field() . '
                    ' . method_field('DELETE') . '
                    <button class="btn btn-danger btn-sm" type="submit" onclick="return confirm('Silmek istediğinize emin misiniz?')">Sil</button>
                </form>';
            return $btn;
        })
        ->rawColumns(['action', 'status', 'treatment'])
        ->make(true);
}

customer/index.blade.php

@extends('layouts.app')
@section('title', 'Müşteriler')
@section('css')
    <link href="{{ asset('assets/lib/select2/css/select2.min.css') }}" rel="stylesheet">
    <link href="//cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
@endsection
@section('content')
    <div class="slim-mainpanel">
        <div class="container">

            @if(session('success'))
                <div class="alert alert-solid alert-success mg-t-25" role="alert">
                    {{ session('success') }}
                </div>
            @endif

            <div class="section-wrapper mg-t-20">
                <div class="report-summary-header">
                    <div>
                        <h4 class="tx-inverse mg-b-3">Müşteriler</h4>
                        <p class="mg-b-0">Müşterilerin listelendiği sayfadır.</p>
                    </div>
                    <div>
                        <a href="{{ route('customer.create') }}" class="btn btn-primary"><i
                                class="icon ion-ios-plus-outline tx-24"></i> Yeni Ekle</a>
                    </div>
                </div><!-- d-flex -->

                <div class="table-responsive">
                    <table class="table table-bordered table-colored" id="customers">
                        <thead>
                        <tr>
                            <th class="wd-5p">#</th>
                            <th>Kayıt Tarihi</th>
                            <th>Adı</th>
                            <th>Telefon</th>
                            <th>Durum</th>
                            <th>Tedavi</th>
                            <th>İşlem</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                    <br>
                </div><!-- table-wrapper -->
            </div><!-- section-wrapper -->

        </div><!-- container -->
    </div><!-- slim-mainpanel -->
@endsection
@section('js')
    <script src="//cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
    <script src="{{ asset('assets/lib/moment/js/moment.js') }}"></script>
    <script src="{{ asset('assets/lib/select2/js/select2.min.js') }}"></script>
    <script src="{{ asset('assets/lib/jquery-ui/js/jquery-ui.js') }}"></script>
    <script src="{{ asset('assets/js/app.js') }}"></script>
    <script>
        $('#customers').DataTable({
            processing: true,
            serverSide: true,
            ajax: "{{ route('customer.list') }}",
            columns: [
                {data: 'DT_RowIndex'},
                {data: 'created_at'},
                {data: 'name'},
                {data: 'phone'},
                {data: 'status'},
                {data: 'treatment'},
                {
                    data: 'action',
                    name: 'action',
                    orderable: true,
                    searchable: true
                },
            ],
            search: {
                return: true,
            },
            language: {
                "url": "//cdn.datatables.net/plug-ins/1.13.4/i18n/tr.json"
            },
        });
    </script>
@endsection

close new open window when clicked on print button

I’m using this function to print the content of a specific div

 print() {
  let popupWin = window.open('', '_blank', 'width=1080,height=595');
  var htmlToPrint = '' +
  '<style type="text/css">' +
  'table th, table td {' +
  'border:1px solid #000;' +
  'padding;0.5em;' +
  '}' +
  '</style>';

  popupWin.document.open();
 
  let printContents = this.Page.nativeElement.innerHTML;
  htmlToPrint += printContents;
  let printHead = document.head.innerHTML;
  popupWin.document
    .write(`<html>
       ${printHead}
      <body onload="window.print();">${htmlToPrint}</body></html>`);
  popupWin.document.close();

}

but the issue here is there are one window open and above that another print dialog gets open when i close the print dialog print window is still open i want to close the new opened winsow as soon as clicked on print or cancel button.

Dynamic rendering of Iframe in Vue.js

I am using vue.js and nuxt in my setup. I am trying to dynamically render my Iframe with a computed property based on a condition. The computed property is called in a different component. Based on my console.log I think there’s no issue in my call. Even if videoRemoved should dynamically be false the div holding the Iframe is still rendered(Vue has had some problems with the Iframe in the past that’s why my v-if is in the div. I feel like it has to do with vues dynamic rendering. Every possible hint is deeply appreciated.

<template>
    <div v-if="videoRemoved" class="relative w-full max-w-screen-lg mx-4 aspect-video">
        <iframe
          ref="videoPlayer"
          :src="item.src"
          title="Videoplayer"
          frameborder="0"
          allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-    picture"
          allowfullscreen
          class="absolute inset-0 w-full h-full"
        />
    </div>
  </template>
  
  <script>
import { nextTick } from 'vue';

export default {
  name: 'LightboxVideo',
    props: {
    item: {
      type: Object,
      default: () => null,
    },
  },
    computed: {
    videoRemoved( boolean) {
        if (boolean) {
            console.log(true)
            return true
        } else {
            console.log(false)
            return false 
        }
    },
}}
</script>

Method call in the lightbox component

<script>
import { Carousel, Slide } from 'vue3-carousel'
import LightboxVideo from '@/components/lightbox/video.vue'

export default {
    name: 'UiLightbox',

    components: {
        Carousel,
        Slide,
    },

    props: {
        items: {
            type: Array,
            default: () => [],
        },
    },

    data() {
        return {
            open: false,
            currentIndex: 0,
            carouselSettings: {
                itemsToShow: 1,
                itemsToScroll: 1,
                wrapAround: true,
                snapAlign: 'center',
            },
        }
    },

    mounted() {
        document.addEventListener('keydown', (e) => {
            if (e.key === 'Escape') {
                this.open = false
            }
        })

        // prev item on left arrow
        document.addEventListener('keydown', (e) => {
            if (e.key === 'ArrowLeft') {
                this.prevItem()
            }
        })

        // next item on right arrow
        document.addEventListener('keydown', (e) => {
            if (e.key === 'ArrowRight') {
                this.nextItem()
            }
        })
    },

    watch: {
        open: {
            handler(val) {
                if (val) {
                    // document && document.body.classList.add('overflow-hidden')

                    this.$nextTick(() => {
                        this.init()
                    })
                } else {
                    // document && document.body.classList.remove('overflow-hidden')
                }
            },
            immediate: true,
        },
    },

    methods: {
        init() {
            this.$refs.carousel.restartCarousel()
        },

        prevItem() {
            this.$refs.carousel.prev()
        },

        nextItem() {
            this.$refs.carousel.next()
        },

        openLightbox() {
            this.open = true
            this.startVideo()
        },

        closeLightbox() {
            this.open = false
            this.stopVideo()
        },
        stopVideo() {
            LightboxVideo.computed.videoRemoved(false)
        },
        startVideo() {
            LightboxVideo.computed.videoRemoved(true)
        },
    },
}
</script>