Skip to content

Fix playground sample config synchronization - #11660

Open
Patrick Ribbsaeter (patrickswedish) wants to merge 1 commit into
microsoft:mainfrom
patrickswedish:agent/preserve-playground-sample-config
Open

Fix playground sample config synchronization#11660
Patrick Ribbsaeter (patrickswedish) wants to merge 1 commit into
microsoft:mainfrom
patrickswedish:agent/preserve-playground-sample-config

Conversation

@patrickswedish

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Playground drops sample compilerOptions / preferredEmitter when selecting a sample

1 participant