Next.js Discord

Discord Forum

getting error: Invariant: static generation store missing in revalidateTag _N_T_/profile

Unanswered
Thrianta posted this in #help-forum
Open in Discord
Avatar
ThriantaOP
can anyone help me why this error happaning and how to fix that .my code is:

"use client";
import { BiLoader } from "react-icons/bi";
import { MdVisibilityOff } from "react-icons/md";

import { MdVisibility } from "react-icons/md";
import axios from "axios";
import { revalidatePath } from "next/cache";
import { useState } from "react";
import toast from "react-hot-toast";
import Link from "next/link";

const BookmarkVisibilityToggle = ({ id, visibility }) => {
  const [isLoading, setIsLoading] = useState(false);
  const handlePatch = async () => {
    setIsLoading(true);
    try {
      await axios.patch(process.env.NEXT_PUBLIC_API_URL + "/bookmark/" + id, {
        visibility: !visibility,
      });
      toast.success("visibility Successfully Changed");
      revalidatePath("/profile");
      setIsLoading(false);
    } catch (error) {
      toast.error(error.message);
    }
  };
  return (
    <Link
      href={"/profile?showing=b"}
      disabled={isLoading}
      onClick={handlePatch}
    >
      {isLoading ? (
        <BiLoader />
      ) : visibility ? (
        <MdVisibility />
      ) : (
        <MdVisibilityOff />
      )}
    </Link>
  );
};
export default BookmarkVisibilityToggle;


im using javascript and nextjs version 13.5

3 Replies

Avatar
SupremeDeity
The code you posted does not have the part where you revalidate and the part where the tag is assigned.
Avatar
ThriantaOP
i didnt used revalidateTag anywhere i only used revalidatePath
here im just trying to revalidate my path when data update finish