Only for vue files with tag error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403

Getting the below given error when a vue file that contains code in tag is being pushed. The whole folder structure is only below 2mb. all js and json files are able to successfully push into the repo.
Authentication is done using personal access token.
Authenticate with GitHub using a token

  $ git push origin tmp/frontend
    Enumerating objects: 10, done.
    Counting objects: 100% (10/10), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (7/7), done.
    Writing objects: 100% (7/7), 1.39 KiB | 476.00 KiB/s, done.
    Total 7 (delta 2), reused 0 (delta 0), pack-reused 0
    error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
    send-pack: unexpected disconnect while reading sideband packet
    fatal: the remote end hung up unexpectedly
    Everything up-to-date

How to implement Multiple tooltip or label for bargraphs using react-echarts

I have implemented a react-echarts bargraph with a tooltip on hover of the the graph, and it should show another label on hover of the tooltip, but not working as expected.

I tried with onMouseover events but it is not working as expected, I wanted a bargraph with a tooltip on hover of the graph and on hover of the tooltip it should show additional details of the graph as another tooltip beside the first one.

import React, { useState } from "react";
import ReactDOM from "react-dom";
import ReactECharts from "echarts-for-react";

const BarChartUpdated = ({ data, label, categories }: any) => {
  const [tooltipData, setTooltipData] = useState<{
    x: number;
    y: number;
    details: string;
    isVisible: boolean;
  } | null>(null);

  const generateColors = (categories: string[]) => {
    const colorMap: Record<string, string> = {};
    const colorPalette = [
      "#5470C6",
      "#91CC75",
      "#EE6666",
      "#FAC858",
      "#73C0DE",
      "#9A60B4",
      "#EA7CCC",
    ];
    categories.forEach((category, index) => {
      if (!colorMap[category]) {
        colorMap[category] = colorPalette[index % colorPalette.length];
      }
    });

    return colorMap;
  };

  const categoryColors = generateColors(categories);
  const sanitizedData = data.map((value: number) => (isNaN(value) ? 0 : value));
  const total = sanitizedData.reduce(
    (sum: number, value: number) => sum + value,
    0,
  );

  const option = {
    title: {
      text: label,
    },
    tooltip: {
      trigger: "axis",
      formatter: (params: any) => {
        return params
          .map(
            (item: any) =>
              `<b>${item.name}</b></br> Count: ${item.value > 0 ? item.value : 0}`,
          )
          .join("<br/>");
      },
    },
    toolbox: {
      feature: {
        saveAsImage: { show: true, title: "Save as Image" },
        dataZoom: { show: true, title: "Zoom" },
      },
    },
    xAxis: {
      type: "category",
      data: categories,
    },
    yAxis: {
      type: "value",
    },
    series: [
      {
        type: "bar",
        data: data.map((value: number, index: number) => ({
          value,
          itemStyle: {
            color: categoryColors[categories[index]],
          },
          label: {
            show: true,
            position: "top",
            formatter:
              total <= 0 ? "0%" : `${Math.ceil((value / total) * 100)}%`,
          },
        })),
      },
    ],
    grid: {
      left: "3%",
      right: "4%",
      bottom: "3%",
      containLabel: true,
    },
  };

  const handleMouseOver = (event: any) => {
    if (event && event.data) {
      const { name, value } = event.data;
      const { offsetX, offsetY } = event.event; 
      setTooltipData({
        x: offsetX,
        y: offsetY,
        details: `More details for ${name}: Count ${value}`,
        isVisible: true,
      });
    }
  };


  const handleMouseOut = () => {
    setTooltipData((prev) => (prev ? { ...prev, isVisible: false } : null));
  };

  const handleTooltipMouseEnter = () => {
    setTooltipData((prev) => (prev ? { ...prev, isVisible: true } : null));
  };

  const handleTooltipMouseLeave = () => {
    setTooltipData(null);
  };

  return (
    <>
      <ReactECharts
        option={option}
        style={{ height: 400, width: "100%" }}
        onEvents={{
          mouseover: handleMouseOver,
          mouseout: handleMouseOut,
        }}
      />
      {tooltipData &&
        ReactDOM.createPortal(
          tooltipData.isVisible && (
            <div
              onMouseEnter={handleTooltipMouseEnter}
              onMouseLeave={handleTooltipMouseLeave}
              style={{
                position: "fixed",
                top: tooltipData.y,
                left: tooltipData.x,
                transform: "translate(-50%, -100%)",
                background: "white",
                border: "1px solid #ccc",
                padding: "10px",
                borderRadius: "4px",
                boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
                zIndex: 1000,
              }}
            >
              {tooltipData.details}
            </div>
          ),
          document.body,
        )}
    </>
  );
};

export default BarChartUpdated;

How to sort a nested array of objects in karate framework

First need to sort array accountPeriodDetails by accountSystemID, and for each accountSystemID need to sort the array monthlySummary by paymentReportDate

``
`*def response =
'''
{
  "organization": {
    "accountPeriodDetails": [
      {
        "summaryPeriod": "P25M",
        "accountSystemID": "2",
        "tokenizedAccountNumber": "1X68MG14Z7Y5POID",
        "monthlySummary": [
          {
            "paymentReportDate": "2023-09-17",
            "accountTypeCode": "3",
            "currentCreditLineAmount": null,
            "mostRecentPaymentAmount": 7000,
            "currentBalanceAmount": 63198,
            "scheduledPaymentAmount": 0,
            "newChargesAmount": null,
            "totalPastDueAmount": 0
          },
          {
            "paymentReportDate": "2023-08-17",
            "accountTypeCode": "3",
            "currentCreditLineAmount": null,
            "mostRecentPaymentAmount": 10000,
            "currentBalanceAmount": 56522,
            "scheduledPaymentAmount": 0,
            "newChargesAmount": null,
            "totalPastDueAmount": 0
          }
        ]
      },
      {
        "summaryPeriod": "P25M",
        "accountSystemID": "3",
        "tokenizedAccountNumber": "MP3GOU0VQC4V5QQ0Z9GZVQUZNKH",
        "monthlySummary": [
          {
            "paymentReportDate": "2024-10-31",
            "accountTypeCode": "2",
            "currentCreditLineAmount": 100000,
            "mostRecentPaymentAmount": 100,
            "currentBalanceAmount": 76035,
            "scheduledPaymentAmount": null,
            "newChargesAmount": null,
            "totalPastDueAmount": 0
          },
          {
            "paymentReportDate": "2024-04-30",
            "accountTypeCode": "2",
            "currentCreditLineAmount": 100000,
            "mostRecentPaymentAmount": 432,
            "currentBalanceAmount": 40135,
            "scheduledPaymentAmount": null,
            "newChargesAmount": null,
            "totalPastDueAmount": 0
          }
        ]
      }
    ]
  }
}
  • def accountPeriodDetails = response1.organization.sbfeInformation.accountPeriodDetails
  • print accountPeriodDetails
  • def sorted1 = karate.sort(accountPeriodDetails, x => x.accountSystemID)
  • print sorted1`

I have tried to sort using karate.sort(accountPeriodDetails, x => x.accountSystemID), getting error
<eval>:1:36 Expected ,** but found =>**
karate.sort(accountPeriodDetails, x => x.accountSystemID)

Any javascript function solution will also be helpful

How to Implement Tab Overflow with Dropdown Menu in React (Similar to SAPUI5 IconTabBar)?

I’m working on a React application, and I need to implement tab navigation similar to SAPUI5’s IconTabBar component with an overflow behavior.

In the SAPUI5 example (link below), when there are too many tabs to fit in the available space, the excess tabs are moved to a dropdown/select list.

Example Link: SAPUI5 IconTabBar Overflow Example

How can I implement tabs that will show in a row, and if there are too many to fit, an overflow menu (select list) will appear to allow users to select the remaining tabs.

Are there any existing libraries or components I can use that implement this behavior easily?

How to make a complex JS library

I want to make and understand complex JS libraries like swiper or @apollo-client. It is quite obscure to search online and it goes without saying that my college classes did not include it.

I am willing to take the time and effort to learn and understand it.

I suppose I could peer into a node_modules folder and analyze, but surely there must have been a class or set of documents online that teach about this.

Where may I find the place where I can learn about building and understanding a complex JS library?

Problem With Sending Data to Json File Using PHP and JavaScript

Im creating an website for a school project.

The website consists of a platform where clients can mark classes. Different clients can mark classes on the same day but the same client can only mark one class per day.

I’m using javascript and php to do this with json. I normally use sql for this but my teacher made me use json. I’m having some difficulties with the project.

I want to make it so if a class is Marked it updates to the json file. The json has this structure

[
    {
        "username": "mario",
        "password": "$2y$10$.iAaXdxRMYxGZcn3j8MLL.2orggPOGM8BITHLLf0kNvpTYpRkWkPi"
    },
    {
        "username": "pedro",
        "password": "$2y$10$QjPT67i8I4hTtyGYTzh1V.9LKWbAgqK4M1pLETKDSgG6P8aP2.N1e"
    },
    {
        "username": "alvaro",
        "password": "$2y$10$BnV1kRYSjbG5Jg26GkYx1OXOb6PW1I4qU3DJHa0lQzN/TExYOWNMe"
    }
]

`

My php looks like this

<?php
session_start();

if (!isset($_SESSION['username'])) {
    header('Location: sessoes.html');
    exit;
}

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['logout'])) {
    session_unset();
    session_destroy();
    header('Location: sessoes.html');
    exit;
}

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['new_username'])) {
    $newUsername = trim($_POST['new_username']);
    if (!empty($newUsername)) {
        $dataFile = 'users.json';
        $data = file_exists($dataFile) ? json_decode(file_get_contents($dataFile), true) : [];

        $usernameExists = false;
        foreach ($data as $user) {
            if (isset($user['username']) && $user['username'] === $newUsername) {
                $usernameExists = true;
                break;
            }
        }

        if ($usernameExists) {
            echo "<script>alert('O nome de usuário já existe. Escolha outro.');</script>";

        }else{
            $oldUsername = $_SESSION['username'];
            $_SESSION['username'] = $newUsername;

            foreach ($data as $key => $user) {
                if (isset($user['username']) && $user['username'] === $oldUsername) {
                    $data[$key]['username'] = $newUsername;
                    break;
                }
            }

            file_put_contents($dataFile, json_encode($data, JSON_PRETTY_PRINT));

            header('Location: ' . $_SERVER['PHP_SELF']);
            exit;
        }
    }
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Calendário de Aulas</title>
    <link rel="stylesheet" href="calendario.css">
</head>
<body>
    <div class="logout-container">
        <form method="POST">
            <button type="submit" id="logoutButton" name="logout">LogOut</button>
        </form>
    </div>

    <button id="voltarButton" onclick="window.location.href='index.html'">Voltar</button>

    <h1>Bem-Vindo, <?php echo htmlspecialchars($_SESSION['username']); ?>! 
        <button id="changeUsernameButton" onclick="document.getElementById('changeUsernameForm').style.display='block'">Alterar Nome</button>
    </h1>

    <div id="changeUsernameForm" style="display:none;">
        <form method="POST">
            <input type="text" name="new_username" placeholder="Novo Nome de Usuário" required>
            <button type="submit">Salvar</button>
        </form>
    </div>

    <h2>Calendário de Aulas</h2>
    <br>

    <div id="aulaTipo">
        <select id="tipoAula">
            <option value="Presencial">Presencial</option>
            <option value="Online">Online</option>
        </select>
        <button id="markClassButton" disabled>Marcar Aula</button>
    </div>

    <div class="calendar">
        <div class="calendar-header">
            <button id="prevMonthButton"><<</button>
            <span id="calendarMonth"></span>
            <button id="nextMonthButton">>></button>
        </div>
        <div class="calendar-days-header">
            <div>Dom</div><div>Seg</div><div>Ter</div><div>Qua</div><div>Qui</div><div>Sex</div><div>Sáb</div>
        </div>
        <div id="calendarDays" class="calendar-days"></div>
    </div>

    <div id="message" class="message"></div>

    <script src="calendario.js"></script>
</body>
</html>

and my javascript looks like this

let currentMonth = new Date().getMonth();
let currentYear = new Date().getFullYear();
let selectedDay = null;

function renderCalendar() {
  const monthNames = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
  const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
  const firstDayOfMonth = new Date(currentYear, currentMonth, 1).getDay();
  const today = new Date();

  document.getElementById('calendarMonth').innerText = `${monthNames[currentMonth]} ${currentYear}`;
  const calendarDays = document.getElementById('calendarDays');
  calendarDays.innerHTML = '';

  for (let i = 0; i < firstDayOfMonth; i++) {
    const emptyDay = document.createElement('div');
    calendarDays.appendChild(emptyDay);
  }

  for (let day = 1; day <= daysInMonth; day++) {
    const dayElement = document.createElement('div');
    dayElement.classList.add('calendar-day');
    dayElement.innerText = day;

    const isPast = new Date(currentYear, currentMonth, day) < today.setHours(0, 0, 0, 0);
    if (isPast) {
      dayElement.classList.add('past');
    } else {
      dayElement.onclick = function() { selectDay(day, dayElement); };
    }

    calendarDays.appendChild(dayElement);
  }
}

function selectDay(day, element) {
  const message = document.getElementById('message');
  selectedDay = day;

  const allDays = document.querySelectorAll('.calendar-day');
  allDays.forEach(dayElement => dayElement.classList.remove('selected'));

  element.classList.add('selected');

  const markedClassType = getClassType(day);
  if (markedClassType) {
    message.innerText = `O dia ${day} já tem uma aula marcada: ${markedClassType}`;
    document.getElementById('markClassButton').disabled = true;
  } else {
    message.innerText = `Você selecionou o dia ${day}. Escolha o tipo de aula e clique em "Marcar Aula"`;
    document.getElementById('markClassButton').disabled = false;
  }
}

function isClassMarked(day) {
  const markedClasses = JSON.parse(localStorage.getItem('markedClasses')) || [];
  return markedClasses.some(item => item.day === day);
}

function getClassType(day) {
  const markedClasses = JSON.parse(localStorage.getItem('markedClasses')) || [];
  const classData = markedClasses.find(item => item.day === day);
  return classData ? classData.tipoAula : null;
}

document.getElementById('prevMonthButton').onclick = function() {
  if (currentMonth === 0) {
    currentMonth = 11;
    currentYear--;
  } else {
    currentMonth--;
  }
  renderCalendar();
};

document.getElementById('nextMonthButton').onclick = function() {
  if (currentMonth === 11) {
    currentMonth = 0;
    currentYear++;
  } else {
    currentMonth++;
  }
  renderCalendar();
};

document.getElementById('markClassButton').onclick = function() {
    const tipoAula = document.getElementById('tipoAula').value;

    const markedClasses = JSON.parse(localStorage.getItem('markedClasses')) || [];
    markedClasses.push({ day: selectedDay, tipoAula: tipoAula });

    localStorage.setItem('markedClasses', JSON.stringify(markedClasses));

    document.getElementById('message').innerText = `Aula ${tipoAula} marcada para o dia ${selectedDay}!`;

    document.getElementById('markClassButton').disabled = true;
    renderCalendar();
};

renderCalendar();

css also if u want

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

header {
    background-color: #333;
    color: white;
    padding: 10px 0;
    text-align: center;
}

header nav a {
    color: white;
    margin: 0 15px;
    text-decoration: none;
    font-size: 18px;
}

header nav a:hover {
    text-decoration: underline;
}

  body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    text-align: center;
    padding: 20px;
    position: relative;
  }
  
  h1 {
    margin-bottom: 20px;
  }
  
  #voltarButton, #logoutButton {
    position: fixed;
    top: 20px;
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 20px;
    z-index: 10;
}

#voltarButton {
    left: 20px;
}

#logoutButton {
    right: 20px;
}

#voltarButton:hover, #logoutButton:hover {
    background-color: #0b7dda;
}
  
  #aulaTipo {
    margin-bottom: 20px;
  }
  
  #tipoAula {
    padding: 10px;
    font-size: 1rem;
  }
  
  button {
    padding: 10px;
    font-size: 1rem;
    cursor: pointer;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 5px;
  }
  
  button:hover {
    background-color: #555;
  }
  
  .calendar {
    display: inline-block;
    border: 1px solid #ccc;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 450px;
    box-sizing: border-box;
  }
  
  .calendar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    align-items: center;
  }
  
  #calendarMonth {
    font-size: 1.5rem;
    font-weight: bold;
  }
  
  .calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 10px;
  }
  
  .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-gap: 10px;
  }
  
  .calendar-day {
    padding: 15px;
    cursor: pointer;
    background-color: #e1edf2;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    text-align: center;
    font-size: 1.1rem;
    height: 50px;
    width: 50px;
    margin: auto;
    box-sizing: border-box;
  }
  
  .calendar-day:hover {
    background-color: #3D3D3D;
    color: white;
  }
  
  .calendar-day.selected {
    background-color: #000;
    color: white;
    font-weight: bold;
  }
  
  .calendar-day.presencial {
    background-color: #4CAF50;
    color: white;
  }
  
  .calendar-day.online {
    background-color: #2196F3;
    color: white;
  }
  
  .message {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #3D3D3D;
  }
  
  @media (max-width: 768px) {
    .calendar {
      width: 90%;
    }
  
    .calendar-day {
      padding: 10px;
      font-size: 1rem;
      height: 45px;
      width: 45px;
    }
  }
  

  .past {
    color: #ccc;
    pointer-events: none;
  }

I also want to make it so if the user is mario instead of showing the callender it shows the names of the people that have a class already and the day.

I know the code is terrible and has both portuguese and english but this isnt the final version and i will translate it all. It’s just hard for me to code in Portuguese. I prefer english. Im sorry if the question im asking is really eazy or stupid but i could really use some help.

I tried a lot of different ways to update the json file but none were successful

How can I center elements in the last row in a grid (CSS, JSX)?

Each row can have a max of 4 elements, but if it has less (1, 2, 3) those elements should be centered. And if there are only 1,2, or 3 elements, those should be centered too. The justify-content doesn’t seem to be working and I’ve also tried using justify-items as well.

Clarification: the ‘.tech-used’ tag is just for a parent element, but I didn’t include it in the JSX code snippet.

<div className="tech-grid">
   {project.skills.map((skill, index) => (
       <div className="tech-item" key={index}>
          <img src={skill.logo} alt={`${skill.name} logo`} className="skill-logo"/>
          <p>{skill.name}</p>
        </div>
    ))}
</div>
.tech-used{
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}


    .tech-grid{
        display: grid;
        grid-template-columns: repeat(4,1fr);
        gap: 30px;
        justify-content: center;
    }

    .tech-item{
        display: flex;[![enter image description here][1]][1]
        flex-direction: column;
        align-items: center;
    }

How to take user input as an object that can be called at a later time?

I am trying to create a feature in a calendar program that allows me to click a button to prompt a user to fill out a form (my attempt at this was the “addEvent” and “Activity” functions). This form then needs to be added to a list called “activities” that I can call from at a later time. I also made a section that is supposed to clear the form after the submit button is pressed but that doesn’t work how I wanted it to. This is what I have so far:


          <div class="events" id="toggle">
            <a class="active" onclick="toggleShow()">+ Add Event</a>  
            <div class="eventInputs">
              Title: <input type ="text" id = "title"><br/><br/>
              Day:  <input type ="text" id = "day"><br/><br/>
              Time: <input type ="text" id = "time"><br/><br/>
            </div>
            <input type="button" id="submitButton" onclick="addEvent()"    value="Submit">
            <p id="output"></p>
          </div>

         <script>
          let activities = []


          function Activity(title, day, time) {
              this.title = title;
              this.day = day;
              this.time = time
          }

          function addEvent() {
              var newActivity =  new Activity(
                document.getElementById("title").value, 
                document.getElementById("day").value, 
                document.getElementById("time").value
              );
              activities.push(newActivity);

              var output = document.getElementById("output"); 
              output.innerHTML += `<p>${activity.title} on ${activity.day} at                     ${activity.time}</p>`; 

              // Clear the form 
              document.getElementById("title").value = '';
              document.getElementById("day").value = '';
              document.getElementById("time").value = '';
            }

          function toggleShow() {
              var y = document.getElementById("toggle");
              if (y.style.display === "none") {
                y.style.display = "block";
              } else {
                y.style.display = "none";
              }
          }
      </script>

What’s been happening with this section is that I click the “add event” button, and my form pops up, but when I press the submit button, nothing happens, and the form doesn’t clear until I clear it manually.

Getting “reobserveAsConcast is not a function” error after updating to Apollo Client 3.12.0

I recently updated my Apollo Client version from 3.5.8 to 3.12.0, and now I’m encountering an error when using the useLazyQuery hook. The error states:

observable.reobserveAsConcast is not a function

This error appears to be triggered within the executeQuery function, which is used internally by useLazyQuery. Here’s is the code: https://github.com/apollographql/apollo-client/blob/6ffb5a34a39657568db7f4e42ed60d8679cb817f/src/react/hooks/useLazyQuery.ts#L222

I’m using useLazyQuery like this:

const [
    fetchData,
    { data, loading: isLoading, error: fetchError },
] = useLazyQuery(SOME_QUERY, {
    fetchPolicy: "no-cache",
});

The error occurs whenever I trigger the fetchData function.

I also updated react from version 17 to 18

Are there any changes in how useLazyQuery or ObservableQuery should be used in Apollo Client 3.12.0?

I would greatly appreciate any guidance or insights into resolving this issue. Thank you!

How to retrieve Information from Java Spring backend to use on React frontend?

I have a backend server which uses Java SpringBoot, running on port 8080 and a frontend server which uses React, running on port 3000.

I want to be able to authenticate a user’s login on the frontend by what I think would be a GET request through axios.get() to the backend through querying the MySQL database and see if the user exists in the results (returned from doing a simple select * from users) . There might be a better way.

Initially I have researched how some articles show the connection to the database and data querying being performed on the frontend e.g. https://javascript.plainenglish.io/build-a-simple-login-system-with-react-and-mysql-7b491737abac ) but that doesn’t seem secure and would slow things down.

Any thoughts?

Error Using useField in a Custom Field Component for Payload CMS

I’m working on a custom field component for a Payload CMS array field. I followed the Payload CMS docs and attempted to use useField to manage the field’s value. Here’s the code:

'use client'

import { ArrayFieldClientProps } from 'payload'
import { useField } from '@payloadcms/ui'

export default function SeriesProductParameterValueField({ path }: ArrayFieldClientProps) {
  console.log('path', path)

  const { value, setValue } = useField({ path })

  return <div>SeriesProductParameterValueField</div>
}

However, the line const { value, setValue } = useField({ path }) throws the following error:

Unhandled Runtime Error: TypeError: Cannot destructure property 'config' of 
'(0 , _chunk_3MXUY6XL_js__WEBPACK_IMPORTED_MODULE_10__.b)(...)' as it is undefined.

Here’s a snippet of my collection configuration for context:

{
  name: 'products',
  type: 'array',
  fields: [
    {
      type: 'row',
      fields: [
        {
          name: 'title',
          type: 'text',
          required: true,
        },
        {
          name: 'image',
          type: 'upload',
          relationTo: 'media',
          required: true,
        },
      ],
    },
  ],
},
{
  name: 'parameterGroups',
  type: 'array',
  fields: [
    {
      name: 'title',
      type: 'text',
      required: true,
      localized: true,
    },
    {
      name: 'parameters',
      type: 'array',
      fields: [
        {
          name: 'parameter',
          type: 'relationship',
          relationTo: 'parameters',
          required: true,
        },
        {
          name: 'values',
          type: 'array',
          fields: [
            {
              name: 'productId',
              type: 'text',
              required: true,
              unique: true,
            },
            {
              name: 'value',
              type: 'text',
              localized: true,
            },
          ],
          admin: {
            components: {
              Field: '/components/payload/series-product-parameter-value-field',
            },
          },
        },
      ],
    },
  ],
},
  • Why is useField throwing this error?
  • Is there something wrong with how I’m setting up useField or the component path in the config?
  • Any guidance or examples for implementing custom field components in Payload CMS?

Thanks in advance for your help!

Doctype HTML stops smooth div expansion

So I have a menu inside a div. That div expands on click. It has a transition easement on it of 1second. It works perfectly fine without <!doctype html> in the doc. Adding <!doctype html> stops the smooth transition (but it still opens and closes).

I feel like it’s something really stupid.

Here is the body code:

<nav class="navigation">
<ul class="mainmenu">
<li><a href="javascript:;" onclick="showSubMenu(event)" class="TOCexpand">BIG TITLE</a>
<ul class="submenu">
<li class="bookchapter">
OPTION
<br>
<a class="booklink" href="">

</a></li>

</ul>
</li>
</ul>
</nav>
 
<script>
function showSubMenu(e) {
e.target.parentNode.classList.toggle('active');
}
</script>

And here is the CSS.

.navigation {
    width: 100%;
    text-align: center;
    margin-bottom:25px;
}

.mainmenu, .submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mainmenu a {
    display: block;
}

.mainmenu li.active .submenu {
    display: block;
    max-height: 100%;
}

a.TOCexpand {
    font-family: 'norseregular';
    font-weight: normal;
    font-style: normal;
    color: #e53f3f;
    font-size: 300%;
    text-shadow: 2px 4px 0px #000;
    letter-spacing: 5px;
}

.submenu {
overflow: hidden;
max-height: 0;
-webkit-transition: all 1.00s ease-out;
-moz-transition: all 1.00s ease-out;
-o-transition: all 1.00s ease-out;
-ms-transition: all 1.00s ease-out;
font-family: 'norseregular';
font-weight: normal;
font-style: normal;
}

li.book {
    font-family: 'Noto Serif';
    font-size: 200%;
    margin-top: 25px;
}

li.bookchapter {
    font-family: 'Noto Serif';
    font-size: 200%;
}

a.booklink {
    font-family: 'norseregular';
    font-weight: normal;
    font-style: normal;
    margin-bottom: 33px;
    margin-top: 5px;
    letter-spacing: 5px;
    font-size: 90%;
}

I realized it was the doctype. Removing that makes it work. Adding it back makes it not work properly.