Skip to content

fix(docs-infra): stop duplicating code editor listeners on re-initialization - #71097

Open
MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:docs-infra/code-editor-listener-leak
Open

MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:docs-infra/code-editor-listener-leak

Conversation

@MeAkib

@MeAkib MeAkib commented Sep 30, 2026

Copy link
Copy Markdown
Contributor
  • async-operations: return headers and timeout from the validateHttp request function (they are HttpResourceRequest properties, not httpResource options), and fix the invalid object literal in the parse example.
  • validation: remove a stray | from a component snippet, fix the "multiple errors" example (a@b is a valid email address for the email() validator, a@ isn't), rename field to fieldTree in the FieldContext table, add the missing signal import, use one zod import style, and clarify that dynamic schemas are passed as a function.
  • custom-controls: DisabledReason exposes fieldTree, not field.
  • migration: use extractValue() to get the whole form value instead of building it manually, and fix the expected output.
  • form-logic: refer to the FormField directive by name, release the timer when the debounce example is aborted, and add the missing form import.
  • comparison example: submit through FormRoot and a submission action, so the page no longer reloads on submit.

…ization

`CodeMirrorEditor` is a root service, and the code editor component calls
its `init()` when it's created and `disable()` when it's destroyed.
`disable()` unsubscribes most listeners created by `init()`, but not the
ones for the TypeScript VFS worker events and the library typings, which
only completed when the root service was destroyed.

Each time the editor was created again (e.g. when moving between the
playground and a tutorial), another pair of subscriptions was added, so
the virtual file system was recreated and the library types were sent to
the worker once per previous initialization.

Keep these subscriptions and unsubscribe them in `disable()`, like the
other listeners.
@pullapprove
pullapprove Bot requested a review from JeanMeche September 30, 2026 17:27
@angular-robot angular-robot Bot added the area: docs-infra Angular.dev application and infrastructure label Sep 30, 2026
@ngbot ngbot Bot added this to the Backlog milestone Sep 30, 2026
@MeAkib
MeAkib force-pushed the docs-infra/code-editor-listener-leak branch from 7fe4993 to 960a55e Compare September 30, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs-infra Angular.dev application and infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant