Concrete
Rulesislands

concrete/islands/no-editor-globals

No code reads the editor canvas's internal `__tr` globals.

No code reads the editor canvas's internal __tr globals.

Graded by the lint stage of concrete check, in the lint venue. A violation reports this id and the file it failed at — see every rule and concrete check.

Reason

The canvas publishes its bridge on a window global, and sniffing one was the folklore way to ask "am I being edited" — each copy re-guessing the name, a wrong guess sitting silently inert, because nothing fails when a global is simply absent. It is a platform internal with no compatibility promise, and a published island bundle is immutable: a rename in the host would break every bundle already in the wild. The island contract gives you the supported question instead.

Fix

Call useEditor() from @homepages/concrete. It returns { inCanvas, selection }, is hydration-safe, and answers with published-page values everywhere outside the canvas.

Before and after

// The Before reads an undeclared global, so it is also a type error.
// @noErrors
"use client";

import type { IslandEditor } from "@homepages/concrete";

export const editor = { live: true } satisfies IslandEditor;

export default function Slider() {
  const editing = window.__trEditorBridge !== undefined;
  return <div data-editing={editing} />;
}
"use client";

import { useEditor } from "@homepages/concrete";
import type { IslandEditor } from "@homepages/concrete";

export const editor = { live: true } satisfies IslandEditor;

export default function Slider() {
  const { inCanvas } = useEditor();
  return <div data-editing={inCanvas} />;
}

On this page