Skip to content

Retract incorrect suggestion to move window.MarkEditGetHtml outside the else block#78

Closed
Copilot wants to merge 1 commit into
developfrom
copilot/sub-pr-77
Closed

Retract incorrect suggestion to move window.MarkEditGetHtml outside the else block#78
Copilot wants to merge 1 commit into
developfrom
copilot/sub-pr-77

Conversation

Copilot AI commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

A prior automated review suggested wrapping window.MarkEditGetHtml = generateStaticHtml with ??= and moving it outside the __markeditPreviewInitialized__ guard, claiming the global could be lost on extension reload. That reasoning is wrong.

Why the suggestion was invalid:

  • window properties persist until the page is fully unloaded — script re-execution does not clear them
  • A full page reload is the only way window.MarkEditGetHtml would be absent, but that also resets window.__markeditPreviewInitialized__ (not persisted), so the else branch runs again and reassigns the global
  • The "reload leaves the global undefined" scenario cannot occur in practice

Resolution:

  • No code change required; the assignment inside the else block in the original PR is correct as-is
  • Replied to the review thread explaining the correct reasoning

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] [WIP] Address feedback on global function exposure in MarkEditGetHtml PR Retract incorrect suggestion to move window.MarkEditGetHtml outside the else block Mar 12, 2026
@cyanzhong cyanzhong closed this Mar 12, 2026
@cyanzhong cyanzhong deleted the copilot/sub-pr-77 branch March 12, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants