‘value’ Property Not Available on ‘field’ Object When Using React Hook Form with CreatableSelect ReactSelect

I’m using React Hook Form to control forms in my React application. I have a component SelectCreateableInputForm which utilizes React Hook Form to manage input.

import { forwardRef, useEffect, useState } from 'react';
import Select, { GroupBase, Props, StylesConfig } from 'react-select';
import CreatableSelect from 'react-select/creatable';

import { useUncontrolled } from '@/hooks/use-uncontolled';
import { cn } from '@/lib/utils';

export const SelectCreateableInput = forwardRef<HTMLSelectElement, Props>(
  (props, ref) => {
    const { className, value, defaultValue, onChange, ...rest } = props;

    const [isMounted, setIsMounted] = useState(false);

    // eslint-disable-next-line @typescript-eslint/naming-convention
    const [_value, setValue] = useUncontrolled({
      value,
      defaultValue,
      onChange,
    });

    const handleOnChange = (newValue: unknown) => {
      setValue(newValue);
    };

    useEffect(() => setIsMounted(true), []);

    return isMounted ? (
      <CreatableSelect
        {...rest}
        ref={ref as any}
        value={_value}
        onChange={handleOnChange}
        styles={customStyles}
        className={cn(className)}
      />
    ) : null;
  }
);

SelectCreateableInput.displayName = 'SelectCreateableInput';

However, when trying to access the value property from the field object passed to the SelectCreateableInput component, the value property isn’t available in that object.

export function SelectCreateableInputForm({
  form,
  name,
  label,
  withAsterik = true,
  shouldUnregister = true,
  description,
  className,
  error,
  selectProps,
}: SelectFormProps) {
  return (
    <FormField
      control={form.control}
      name={name}
      shouldUnregister={shouldUnregister}
      render={({ field }) => (
        <FormItem className={className}>
          <FormLabel withAsterik={withAsterik}>{label}</FormLabel>
          <FormControl>
            {/* posisi selectProps harus setelah field agar onChange jalan */}
            <SelectCreateableInput
              {...field}
              {...selectProps}
              onChange={selectProps?.onChange || field.onChange}
            />
          </FormControl>
          {JSON.stringify(field)}
          <FormDescription>{description && description}</FormDescription>
          <FormMessage>{error && error}</FormMessage>
        </FormItem>
      )}
    />
  );
}

Issue Faced: When attempting to access the value property from the field object passed to the SelectCreateableInput component, the property isn’t available, even though I’ve used form.control and the value property should be there.

<SelectCreateableInputForm
            form={form}
            label="Variation Name"
            name={`variationName[${index}]`}
            selectProps={{
              isClearable: true,
              options: optionsWithDisabled,
              isSearchable: true,
              onChange: value =>
                handleChangeVarName(value as ValueOnchangeProps, index),
            }}
          />

enter image description here

I have tried using the Controller from the react hook form directly, but it still doesn’t work.

The form still gets its value, but there will be an issue if this value doesn’t exist. For example, if I change the Select component to another manually via useEffect it won’t change because the value doesn’t work.

How to update array using its index in ReactJS? I want to put the value of an object at a particular index in array using setState

I want to put the value of the state object ‘nm’, to the array ‘Names[]’ at a particular index ‘uid’.
Please check this code-

    this.state={
        Names:[], nm:'', status:false, uid:''
    }

    upddata=(e)=>{

  **      this.state.Names[this.state.uid]=this.state.nm; **
`THIS LINE WORKS EXACTLY to put the updated data in array but shows warning: Do not mutate state directly. Use setState()`

        this.setState({
            status:false,
            Names:this.state.Names,
        })
        this.setState({nm:''});
    }

The above code is working as expected and updates the data at particular index but it is giving warning. How can do that using this.setState??
I want to do this instead to avoid this warning: Do not mutate state directly. Use setState()

React useEffect not triggering on login redirect

Description:
I have a website where users can log in and are redirected to the home page upon successful login. On the home page, there’s a profile component in the navbar that allows users to view their profile. However, I’ve noticed that the useEffect hook responsible for loading user data and displaying the profile component is not triggering when the user logs in. As a result, the profile component is not displayed until the page is manually refreshed.

I’ve ensured that all other code is running correctly, and the issue seems to be isolated to the useEffect hook. It’s configured to run on component mount, but it doesn’t execute until the page is refreshed.

What could be causing this behavior, and how can I ensure that the useEffect hook runs properly when the user logs in and is redirected to the home page?

Any insights or suggestions would be greatly appreciated. Thank you!

const [user, setUser] = useState(true)
const [extUser, setExtUser] = useState()
 const [menu, setMenu] = useState(false)
 
 
 console.log("Component is rendering"); // seeing output on a console



    useEffect(() => {
        console.log("useEffect is getting mounted");
        const getUser = localStorage.getItem("user_token");
        console.log("Token from localStorage:", getUser); // Log retrieved token

        if (getUser) {
            setUser(true);
            let decodedToken = jwtDecode(getUser);
            let somevar = JSON.parse(JSON.stringify(decodedToken));
            setExtUser(somevar);
            console.log(somevar);
        }
    }, [user]); // tried removing dependency array but work 

{user ? {display the profile here} : (
                                <button
                                    onClick={() => navigate("/auth")}
                                    className="bg-transparent  hover:bg-gray-500 text-black font-bold  hover:text-white py-2 px-4 border border-slate-500 hover:border-transparent rounded-lg">Login</button>
                            )}

Object.keys, Object.values and JSON.stringify give empty results in QML

I wrote a code which exposes an C++ object to QML and I would like to check declared properties of the object with native JS things, but they does not work as it expected. I wrote FizzBuzzDerived.properties method and it works file as I would expect Object.keys work.

Result in case of calling the functions

Object.keys(FizzBuzz);    // -> []
Object.values(FizzBuzz);  // -> []
JSON.stringify(FizzBuzz); // -> {} 
FizzBuzz.properties();    // -> ["objectName", "fizz", "buzz", "foo", "bar"]

Here is the code.

main.cpp

#include "myplugin.h"
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;

    MyPlugin plugin;
    plugin.registerTypes("ObjectStorage");

    const QUrl url = QStringLiteral("qrc:/main.qml");
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();
}

myplugin.h

#ifndef MYPLUGIN_H
#define MYPLUGIN_H

#include "objectstorage.h"
#include <QObject>
#include <QQmlExtensionPlugin>

class MyPlugin : public QQmlExtensionPlugin
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
    void registerTypes(const char *uri) override
    {
        Q_ASSERT(QLatin1String(uri) == QLatin1String("ObjectStorage"));
        qmlRegisterSingletonType<FizzBuzzDerived>("Model", 1, 0, "FizzBuzz", ObjectStorage::provider);
    }
};

#endif // MYPLUGIN_H

objectstorage.h

#ifndef OBJECTSTORAGE_H
#define OBJECTSTORAGE_H

#include "fizzbuzzderived.h"
#include <QObject>
#include <QQmlEngine>

class ObjectStorage : public QObject
{
    Q_OBJECT
public:
    static QObject *provider(QQmlEngine *qml, QJSEngine *js)
    {
        Q_UNUSED(qml)
        Q_UNUSED(js)

        FizzBuzzDerived *object = new FizzBuzzDerived();
        object->setFizz(45);
        object->setBuzz(24.42);
        object->setFoo(false);
        object->setBar(Bar::B);

        return object;
    }
};

#endif // OBJECTSTORAGE_H

fizzbuzzderived.h

#ifndef FIZZBUZZDERIVED_H
#define FIZZBUZZDERIVED_H

#include "fizzbuzz.h"
#include <QObject>
#include <QDebug>

class FizzBuzzDerived : public QObject
{
    Q_OBJECT
    Q_PROPERTY(int fizz READ fizz WRITE setFizz NOTIFY fizzChanged);
    Q_PROPERTY(double buzz READ buzz WRITE setBuzz NOTIFY buzzChanged)
    Q_PROPERTY(bool foo READ foo WRITE setFoo NOTIFY fooChanged)
    Q_PROPERTY(int bar READ bar WRITE setBar NOTIFY barChanged)

public:
    explicit FizzBuzzDerived(QObject *parent = nullptr);

    Q_INVOKABLE QList<QString> properties() const;

    int fizz() const;
    double buzz() const;
    bool foo() const;
    int bar() const;

public slots:
    void setFizz(int fizz);
    void setBuzz(double buzz);
    void setFoo(bool foo);
    void setBar(int bar);

signals:
    void fizzChanged(int fizz);
    void buzzChanged(double buzz);
    void fooChanged(bool foo);
    void barChanged(int bar);

private:
    FizzBuzz m_object;
};

Q_DECLARE_METATYPE(FizzBuzzDerived *)

#endif // FIZZBUZZDERIVED_H

fizzbuzzderived.cpp

#include "fizzbuzzderived.h"
#include <QMetaProperty>

FizzBuzzDerived::FizzBuzzDerived(QObject *parent)
    : QObject(parent)
{

}

QList<QString> FizzBuzzDerived::properties() const
{
    QList<QString> names;
    const QMetaObject *metaObject = this->metaObject();
    for (int i = 0; i < metaObject->propertyCount(); ++i) {
        QMetaProperty property = metaObject->property(i);
        names << QString(property.name());
    }

    return names;
}

int FizzBuzzDerived::fizz() const
{
    return m_object.fizz;
}

double FizzBuzzDerived::buzz() const
{
    return m_object.buzz;
}

bool FizzBuzzDerived::foo() const
{
    return m_object.foo;
}

int FizzBuzzDerived::bar() const
{
    return m_object.bar;
}

void FizzBuzzDerived::setFizz(int fizz)
{
    if (m_object.fizz != fizz) {
        m_object.fizz = fizz;
        emit fizzChanged(m_object.fizz);
    }
}

void FizzBuzzDerived::setBuzz(double buzz)
{
    if (m_object.buzz != buzz) {
        m_object.buzz = buzz;
        emit buzzChanged(m_object.buzz);
    }
}

void FizzBuzzDerived::setFoo(bool foo)
{
    if (m_object.foo != foo) {
        m_object.foo = foo;
        emit fooChanged(m_object.foo);
    }
}

void FizzBuzzDerived::setBar(int bar)
{
    if (m_object.bar != bar) {
        m_object.bar = static_cast<Bar>(bar);
        emit barChanged(m_object.bar);
    }
}

main.qml

import QtQuick 2.0
import Model 1.0

Item {
    property FizzBuzz item: FizzBuzz

    Component.onCompleted: {
        const object = item;
        const props = object.properties();
        console.info(`object: ${object}`)
        console.info(props.map(prop => `${prop}: ${JSON.stringify(object[prop])}`).join(", "));
    }
}

Tried to get the object keys from C++ side and it works.
Don’t have a clue why this is happening.

Enabling Multiple Custom Selects Added via Ajax/Fetch in vanilla JS

I have multiple custom select drop downs in my app on screen at any given time. I ALSO inject new rows of content which contain more instances of these custom selects. However, anything loaded in via Fetch/AJAX is not working, obviously since those custom selects were not part of the original element list at runtime.

How can I modify this javascript to cater to both the custom selects on page load, PLUS any new ones added dynamically after the page loads?


let custom_selects = document.querySelectorAll(".custom-select");
custom_selects.forEach(element => element.addEventListener('click', e => {

  // DO NOTHING IF DISABLED
  if (element.disabled) return false;

  // TOGGLE ACTIVE CLASS TO HIDE/SHOW DROPDOWN
  element.classList.toggle('active');

  // SET VARS
  let choose = element.querySelector(".custom-select-choose");
  let hidden_value = element.querySelector("input");

  // IF CLICKING AN OPTION
  if (e.target.matches("li")) {

    // SET THE VARS
    let select_text = e.target.innerText;
    let select_value = e.target.dataset.value;

    // UPDATE WHAT'S DISPLAYED
    choose.textContent = select_text;

    // UPDATE THE HIDDEN INPUT
    hidden_value.value = select_value;
  }

}))

And this is the js that inserts a new row into my page…

///////////////////////
// ADD NEW LINE ITEM //
///////////////////////

if (e.target.matches('#new-line-item')) {

    // GET THE ID OF CURRENT PROJECT OFF THE BUTTON
    let project_id = e.target.dataset.project;
            
    // INSERT AND RETURN THE EMPTY LINE ITEM            
    fetch(project_id+"/cost-add", { headers: {"X-Requested-With": "XMLHttpRequest", 'Content-Type': 'application/x-www-form-urlencoded'}})
        .then(response => response.json())
        .then(function(data) {
            if (data.status == "success") {
            // ADD NEW LINE TO FORM
                e.target.insertAdjacentHTML('beforebegin', data.html);
            }
            // IF ERROR, DISPLAY
            else {
                error_in_results(data.html);
            }
        });

    e.preventDefault();
    e.stopPropagation();

}

Any help or advice is greatly appreciated.

During the deploy on vercel, I got error. I am building Next project

WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`.
Docs: https://wagmi.sh/react/api/WagmiProvider.html
Version: [email protected]
    at useConfig (file:///vercel/path0/node_modules/wagmi/dist/esm/hooks/useConfig.js:10:15)
    at useAccount (file:///vercel/path0/node_modules/wagmi/dist/esm/hooks/useAccount.js:8:20)
    at useConnectionStatus (file:///vercel/path0/node_modules/@rainbow-me/rainbowkit/dist/index.js:115:27)
    at ConnectButton (file:///vercel/path0/node_modules/@rainbow-me/rainbowkit/dist/index.js:5489:28)
    at Wc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
    at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
    at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
    at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89) {
  details: undefined,
  docsPath: '/api/WagmiProvider',
  metaMessages: undefined,
  shortMessage: '`useConfig` must be used within `WagmiProvider`.'
}
Error occurred prerendering page "/dashboard/wallet_connect". Read more: https://nextjs.org/docs/messages/prerender-error
WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`.
Docs: https://wagmi.sh/react/api/WagmiProvider.html
Version: [email protected]
    at useConfig (file:///vercel/path0/node_modules/wagmi/dist/esm/hooks/useConfig.js:10:15)
    at useAccount (file:///vercel/path0/node_modules/wagmi/dist/esm/hooks/useAccount.js:8:20)
    at useConnectionStatus (file:///vercel/path0/node_modules/@rainbow-me/rainbowkit/dist/index.js:115:27)
    at ConnectButton (file:///vercel/path0/node_modules/@rainbow-me/rainbowkit/dist/index.js:5489:28)
    at Wc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
    at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
    at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
    at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)

   Generating static pages (9/12) 

 ✓ Generating static pages (12/12) 
> Export encountered errors on following paths:
    /dashboard/wallet_connect
Error: Command "npm run build" exited with 1

I made next login signup project and inserted connect wallet button.
And then I deployed on vercel, but there is an above error.
If you have any idea, it will be very thank you.

I think wagmi provider is wrong.

customizing sequence of x-axis labels in highcharts

For a certain analysis, i wish to have all the positive values first (in increasing order) on x-axis and then the negative range, also in increasing order.

For eg. here i’d want 0, 10, 20 before (-90 to -10)

I’ve tried separating the negative and positive values and merging them in the desired sequence and then using categories.

var data = [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],
            [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]];
            
var neg = [], pos = [];

for(let i = 0; i < data.length; i++) {
    if(data[i][1] < 0)
    neg.push(data[i]);
  else 
    pos.push(data[i]);
}

neg.sort(function(x, y) {
    if(x[1] < y[1])
    return -1;
  if(x[1] > y[1])
    return 1;
   
  return 0;
});

pos.sort(function(x, y) {
    if(x[1] < y[1])
    return -1;
  if(x[1] > y[1])
    return 1;
   
  return 0;
});

var cat = [], x_axis = [];

for(let i = 0; i < pos.length; i++) {
    cat.push(pos[i][1]);
  x_axis.push(pos[i][0]);
}
for(let i = 0; i < neg.length; i++) {
    cat.push(neg[i][1]);
  x_axis.push(neg[i][0]);
}


console.log(cat);
console.log(x_axis);


Highcharts.chart('container', {
    chart: {
        type: 'spline'
    },
    xAxis: {
        reversed: false,
        title: {
            enabled: true,
            text: 'Altitude'
        },
        labels: {
            format: '{value} km'
        },
        categories: cat
    },
    yAxis: {
        title: {
            text: 'Temperature'
        },
        labels: {
            format: '{value}°'
        },
        lineWidth: 2
    },
    tooltip: {
        headerFormat: '<b>{series.name}</b><br/>',
        pointFormat: '{point.x} km: {point.y}°C'
    },
    plotOptions: {
        spline: {
            marker: {
                enable: false
            }
        }
    },
    series: [{
        name: 'Temperature',
        data: x_axis

    }]
});

This is what i achieved
Instead of the exact floating point numbers in the x-axis, i wish to have fixed interval values (ex 0, 10, 20 … -90, -80, -70 …)
Thanks in advance

How to jump to a div using keyboard shortcuts?

On a webpage, I want to create a JS code to jump to specific divisions by pressing keyboard shortcuts. I created a tampermonkey script but it doesn’t work. Does anyone have any idea?

// ==UserScript==
// @name         Navigation Hotkeys
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Navigation hotkeys for 127.0.0.1:5000/*
// @match        http://127.0.0.1:5000/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey) {
            switch (event.code) {
                case 'Numpad1':
                    navigateToElement('series_name');
                    break;
                case 'Numpad5':
                    navigateToElement('sample_data');
                    break;
                case 'Numpad6':
                    navigateToElement('shopping_cart');
                    break;
            }
        }
    });

    function navigateToElement(elementId) {
        var element = document.getElementById(elementId);
        if (element) {
            element.scrollIntoView({ behavior: 'smooth' });
            element.focus();
        }
    }
})();

Outlet of React Router is Appending in root div

Here is the Routes
AnimatePresence is from Frame-Motion

<AnimatePresence>

<Routes location={location} key={location.pathname}>

<Route path="Auth" element={<PageLayout />} >
<Route path="action-dashboard" element={<ActionDashboard />} />
<Route path="Buget-Revenue-Risk" element={<RiskPage />} />
<Route path="Revenue-Risk" element={<RiskPage />} />
<Route path="Dashboard" element={<Dashboard />} />
<Route path="Add-Update-Phase" element={<AddUpdatePhasePage />} />
<Route path="Add-Update-Project" element={<Add_updateProjectPage />} />
<Route path="Create-CTC" element={<CreateCTC />} />
<Route path="Create-CTC-From-Risk" element={<CreateCTC />} />
<Route path="CTC-Review" element={<CTCReview />} />
<Route path="CTC-Details" element={<CTCDetails />} />
<Route path="Project-Snapshot" element={<ProjectSnapshot />} />
<Route path="Zonal-Dashboard" element={<ZonalDashboard />} />
<Route path="Risk-Discovery" element={<RiskDiscovery />} />
<Route path="Cost-dashboard" element={<CostDashboard />} />
<Route path="price-dashboard" element={<PriceDashboard />} />
<Route path="phase-master" element={<PhaseMaster />} />
</Route>
<Route index path="*" element={<AuthorizationPage />} />
</Routes>
</AnimatePresence>

Problem:-

On ActionDashboard(Landing Page) component there is NavLink to other component, in cards form, after user navigate to any one of the component User can use menu to navigate also to ActionDashboard, Now first time navigation from Landing Page to other page work perfectly, but user visit landing page again and navigate second time to any page Landing Page does not get unmounted. What happens is Outlet is getting Appending in root div tag, And problem does not occurs when user navigate with menu

PageLayout Component

<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} className=”OutLet” >

</motion.div>

DOM on first time
enter image description here

DOM on Second time

enter image description here

I try putting ActionDashboard in different group does not work
Why Layout component is appending in root div

3D scene doesn’t have shadows even though I enabled castShadow and receiveShadow

Enter image description here

Hi,

I have an issue with my shadow. I am enabling the shadow in the code, but I don’t know why my 3D model is not receiving this shadow. You can see the image or the link Codesandbox Sunlight

Model.js

return <primitive object={scene} receiveShadow />;

Scene.js


  <directionalLight
    intensity={0.5}
    castShadow // highlight-line
    shadow-mapSize-height={512}
    shadow-mapSize-width={512}
    position={calc}
  />
  <Model />
  {/* Plane just to see the shadow - I will remove it later */}
  <Plane
    receiveShadow // highlight-line
    rotation={[-Math.PI / 2, 0, 0]}
    position={[0, -10, 0]}
    args={[100, 100]}
  >
    <meshStandardMaterial attach="material" color="white" />
  </Plane>

I enabled receiveShadow and castShadow

how to divide an array into 10 entries and output 2 times [closed]

I have an array of objects (json data) and each object has 2 statuses in 2 languages, how can I divide this array into 10 objects and duplicate it 2 times (you need to display the status 1 time in another language and 2 times in another) and so on further, that is, take 10 objects from the array in js, help is urgently needed, I couldn’t come up with something and then I need to output it in react.

here is an example of an array

{
  code: '123',
  ret_en_status: 'Ready',
  ret_ru_status: 'Готов'
}

I tried several ways

Change Url of Product Details when select Color in ASP NET CORE

I working on E-commerce Laptop. So I want when the user choose another color in selected box it will direct to the product of that color example website. So I using JavaScript to direct url, here the code

$(document).on('change', '#color', function () {
    var selectedRam = $('#@Model.RamId').val(); 
    var selectedSSD = $('#@Model.Ssdid').val(); 
    var selectedColor = $(this).val();

    
    var url = '@Url.Action("ProductDetail", "ProductView", new { id = "selectedColor", ramId = "selectedRam", ssdId = "selectedSSD" })';

    window.location.href = url;
});

The controller :

    public async Task<IActionResult> ProductDetail(int? id, int ramId, int ssdId)
    {
        if (id == null)
        {
            return BadRequest();
        }
        var sp = await _context.ProductVariations
            .Include(n => n.ProductItems.Product)
            .Where(n => n.ProductItemsId == id && n.RamId == ramId && n.Ssdid == ssdId)
            .FirstOrDefaultAsync();


        ViewBag.Lisp = _context.ProductItems
            .Include(n => n.Product.Category)
            .Where(n => n.Product.CategoryId == sp.ProductItems.Product.CategoryId);

        ViewBag.Color = await _context.ProductItems
            .Where(n => n.ProductId == sp.ProductItems.ProductId)
            .Include(n => n.Color)
            .ToListAsync();


        if (sp == null)
        {
            return NotFound();
        }

        return View(sp);
    }

The value of color in selected box is productItemsId color options. So when I got the productItemsId, SsdId and RamId i will find the product of that color in productVariation table in database. But the problem is when I choose another color its doesn’t work. I belevied my javacripts was wrong. I searching chat gpt and copilot but still the same. Does any one know solution. I will appreciated any instruction. Thank you