Skip to content

Fix playground sample config synchronization - #11660

Merged
iscai-msft merged 1 commit into
microsoft:mainfrom
patrickswedish:agent/preserve-playground-sample-config
Aug 17, 2026
Merged

Fix playground sample config synchronization#11660
iscai-msft merged 1 commit into
microsoft:mainfrom
patrickswedish:agent/preserve-playground-sample-config

Conversation

@patrickswedish

Copy link
Copy Markdown
Contributor

Summary

Preserve sample-specific preferredEmitter and compilerOptions values when loading samples in the TypeSpec Playground.

Root cause

Updating Monaco with external sample content calls setValue, which synchronously emits onDidChangeContent. The listener refs were updated in later React effects, so this event could invoke a stale onContentChange closure and overwrite the newly generated tspconfig with the previous Playground state.

Changes

  • Update the Monaco listener refs before synchronizing external content into the editor model.
  • Make the Monaco test double synchronously emit content-change events from setValue.
  • Add regression coverage proving external sample updates are not reported through stale callbacks.
  • Add the required Chronus release-note entry.

Fixes #11659.

Validation

  • pnpm --filter @typespec/playground... build
  • pnpm --filter @typespec/playground test — 59 passed
  • pnpm --filter @typespec/playground lint
  • Prettier check
  • pnpm change verify
  • git diff --check
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
@iscai-msft

Copy link
Copy Markdown
Member

thank you so much Patrick Ribbsaeter (@patrickswedish) for your contribution! I'm going to take a look and help shepherd this pr in

@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/playground@11660

commit: 1a46c71

@iscai-msft
iscai-msft enabled auto-merge August 17, 2026 18:45
@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/playground
Show changes

@typespec/playground - fix ✏️

Preserve a sample's preferred emitter and compiler options when loading it in the playground.

@iscai-msft
iscai-msft added this pull request to the merge queue Aug 17, 2026
Merged via the queue into microsoft:main with commit 7c995f2 Aug 17, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants