Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to this project will be documented in this file.
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Expand All @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Styling design system components used in the web component (#1263)
- Sidebar panel overflow for plugins (#1266)
- Extra lines added at the start of some code blocks (#1267)

## [0.33.0] - 2025-10-15

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,25 @@ import RemoveInstructionsModal from "../../../Modals/RemoveInstructionsModal";
import Prism from "prismjs";
import populateMarkdownTemplate from "../../../../utils/populateMarkdownTemplate";

let prismConfigured = false;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a module-level variable to track configuration state may cause issues if the component is unmounted and remounted, or in React strict mode where effects run twice. Consider using useRef instead to track whether Prism has been configured within the component's lifecycle.

Copilot uses AI. Check for mistakes.

const InstructionsPanel = () => {
useEffect(() => {
// prism and prism plugin config
Prism.manual = true;
if (Prism.plugins.NormalizeWhitespace) {
if (Prism.plugins.NormalizeWhitespace && !prismConfigured) {
Prism.plugins.NormalizeWhitespace.setDefaults({
"remove-indent": false,
"remove-initial-line-feed": true,
"left-trim": false,
});
Prism.hooks.add("before-sanity-check", function (env) {
if (!env.code) return;

// Remove multiple leading blank lines (empty or whitespace-only)
env.code = env.code.replace(/^(?:\s*\n)+/, "");
});
Comment on lines +32 to +37
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hook is added every time the effect runs (even though guarded by prismConfigured), but is never removed. This could lead to duplicate hooks being registered if the component remounts. Consider either: (1) using a cleanup function to remove the hook, or (2) moving the hook registration outside the component entirely since it's global Prism configuration.

Copilot uses AI. Check for mistakes.
prismConfigured = true;
}
}, []);
const [showModal, setShowModal] = useState(false);
Expand Down
Loading