Codegen headache when deleting elements.

I deleted a global screen variant I accidentally added in plasmic studio, and now can’t get anywhere. I can’t publish a site I was due to finish today.

Is there a way to safely delete components without this happening? Codegen is turning into a major headache

Module not found: Can't resolve '../components/plasmic/maerifa_solutions/PlasmicGlobalVariant__UnnamedGlobalGroupOfVariants'
   5 | import GlobalContextsProvider from "../components/plasmic/maerifa_solutions/PlasmicGlobalContextsProvider";
   6 | import { ScreenVariantProvider } from "../components/plasmic/maerifa_solutions/PlasmicGlobalVariant__Screen";
>  7 | import { UnnamedGlobalGroupOfVariantsContext } from "../components/plasmic/maerifa_solutions/PlasmicGlobalVariant__UnnamedGlobalGroupOfVariants";
     | ^
   8 | import { PlasmicHomepage } from "../components/plasmic/maerifa_solutions/PlasmicHomepage";
   9 | import { useRouter } from "next/router";
  10 |

Sorted the initial by the context wrapper from the file, but now I’m getting this:


   Skipping linting
   Checking validity of types  .Failed to compile.

./pages/backup.tsx:6:10
Type error: Module '"../components/plasmic/maerifa_solutions/PlasmicGlobalVariant__Screen"' has no exported member 'ScreenVariantProvider'. Did you mean to use 'import ScreenVariantProvider from "../components/plasmic/maerifa_solutions/PlasmicGlobalVariant__Screen"' instead?

  4 | import { PageParamsProvider as PageParamsProvider__ } from "@plasmicapp/react-web/lib/host";
  5 | import GlobalContextsProvider from "../components/plasmic/maerifa_solutions/PlasmicGlobalContextsProvider";
> 6 | import { ScreenVariantProvider } from "../components/plasmic/maerifa_solutions/PlasmicGlobalVariant__Screen";
    |          ^
  7 | import { PlasmicHomepage } from "../components/plasmic/maerifa_solutions/PlasmicHomepage";
  8 | import { useRouter } from "next/router";
  9 |
   Checking validity of types  ..

Cleared plasmic JSON and the import on my pages, but the automatically generated code keeps reappearing

Type error: Declaration or statement expected.

  16 | });
  17 |
> 18 | export ScreenVariantProvider;
     | ^
  19 | /* prettier-ignore-end */
  20 |
   Checking validity of types  ..

// @ts-nocheck
/* eslint-disable */
/* tslint:disable */
/* prettier-ignore-start */

import * as React from "react";
import { createUseScreenVariants } from "@plasmicapp/react-web";

export type ScreenValue = "mobileOnly";
export const ScreenContext = React.createContext<ScreenValue[] | undefined>(
  "PLEASE_RENDER_INSIDE_PROVIDER" as any
);

export const useScreenVariants = createUseScreenVariants(true, {
  mobileOnly: "(min-width:0px) and (max-width:768px)",
});

export ScreenVariantProvider;
/* prettier-ignore-end */

Hi, a fix for it was pushed, it should be available in production in a few hours.

Awesome. What do I need to update? Thanks for the quick fix it’s really appreciated

You don’t need to update anything, for the already existing files you can just remove the line

import { ScreenVariantProvider } from "../FILE"

The newly generated file won’t include this line.