Skip to content

Commit

Permalink
Merge pull request #22 from plasmicapp/duplicated
Browse files Browse the repository at this point in the history
chore(site-invariants): add notification for projects with duplicated components

GitOrigin-RevId: ff779a2327208b3911cb420d6b8c70eb922c91a5
  • Loading branch information
plasmicops authored and actions-user committed Sep 30, 2024
1 parent 42fd184 commit 51e8249
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion platform/wab/src/wab/client/studio-ctx/StudioCtx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4961,7 +4961,7 @@ export class StudioCtx extends WithDbCtx {
persistentChanges.map((change) => change.changeNode)
);

if (!DEVFLAGS.skipInvariants && Math.random() < 0.05) {
if (!DEVFLAGS.skipInvariants && Math.random() < 0.1) {
// Random check to silently see if results match
this.checkIfMatchesSlowBundle(_bundle, persistentChanges);
}
Expand Down
14 changes: 8 additions & 6 deletions platform/wab/src/wab/shared/site-invariants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import {
walkModelTree,
} from "@/wab/shared/model/model-tree-util";
import { modelConflictsMeta } from "@/wab/shared/site-diffs/model-conflicts-meta";
import * as Sentry from "@sentry/browser";
import L, { uniqBy } from "lodash";

export class InvariantError extends Error {
Expand Down Expand Up @@ -110,12 +111,13 @@ export function* genSiteErrors(site: Site) {
if (!isPlasmicComponent(component) || component.superComp) {
continue;
}
// TODO: Reenable this
// if (componentNames.has(component.name)) {
// yield new InvariantError(`Duplicated component name: ${component.name}`);
// } else {
// componentNames.add(component.name);
// }
if (componentNames.has(component.name)) {
Sentry.captureException(
new InvariantError(`Duplicated component name: ${component.name}`)
);
} else {
componentNames.add(component.name);
}
}

yield* genGlobalContextErrors(site);
Expand Down

0 comments on commit 51e8249

Please sign in to comment.