refactor: collapse editor publication onto a single publisher#2767
Draft
christianhg wants to merge 1 commit into
Draft
refactor: collapse editor publication onto a single publisher#2767christianhg wants to merge 1 commit into
christianhg wants to merge 1 commit into
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📦 Bundle Stats —
|
| Metric | Value | vs main (df69757) |
|---|---|---|
| Internal (raw) | 776.5 KB | -1.2 KB, -0.1% |
| Internal (gzip) | 147.7 KB | -123 B, -0.1% |
| Bundled (raw) | 1.38 MB | -1.1 KB, -0.1% |
| Bundled (gzip) | 309.6 KB | -115 B, -0.0% |
| Import time | 97ms | -0ms, -0.4% |
@portabletext/editor/behaviors
| Metric | Value | vs main (df69757) |
|---|---|---|
| Internal (raw) | 467 B | - |
| Internal (gzip) | 207 B | - |
| Bundled (raw) | 424 B | - |
| Bundled (gzip) | 171 B | - |
| Import time | 2ms | -0ms, -1.0% |
@portabletext/editor/plugins
| Metric | Value | vs main (df69757) |
|---|---|---|
| Internal (raw) | 2.7 KB | - |
| Internal (gzip) | 894 B | - |
| Bundled (raw) | 2.5 KB | - |
| Bundled (gzip) | 827 B | - |
| Import time | 7ms | +0ms, +0.2% |
@portabletext/editor/selectors
| Metric | Value | vs main (df69757) |
|---|---|---|
| Internal (raw) | 79.3 KB | - |
| Internal (gzip) | 14.5 KB | - |
| Bundled (raw) | 74.8 KB | - |
| Bundled (gzip) | 13.4 KB | - |
| Import time | 8ms | -0ms, -0.3% |
@portabletext/editor/traversal
| Metric | Value | vs main (df69757) |
|---|---|---|
| Internal (raw) | 25.4 KB | - |
| Internal (gzip) | 5.0 KB | - |
| Bundled (raw) | 25.4 KB | - |
| Bundled (gzip) | 5.0 KB | - |
| Import time | 6ms | -0ms, -0.1% |
@portabletext/editor/utils
| Metric | Value | vs main (df69757) |
|---|---|---|
| Internal (raw) | 28.7 KB | - |
| Internal (gzip) | 6.0 KB | - |
| Bundled (raw) | 26.7 KB | - |
| Bundled (gzip) | 5.7 KB | - |
| Import time | 6ms | -0ms, -1.6% |
🗺️ . · ./behaviors · ./plugins · ./selectors · ./traversal · ./utils · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @portabletext/markdown
Compared against main (df697572)
| Metric | Value | vs main (df69757) |
|---|---|---|
| Internal (raw) | 53.0 KB | - |
| Internal (gzip) | 9.6 KB | - |
| Bundled (raw) | 347.6 KB | - |
| Bundled (gzip) | 96.0 KB | - |
| Import time | 39ms | +1ms, +3.1% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
The editor's publication surface — the channel backing `editor.on` — was
split across the relay xstate machine, the actor bridges in
`create-editor`, and the `Editable` component reaching for a
`RelayActorContext` to dispatch lifecycle events directly. Three sources
fed `relayActor.send`; one `relayActor.on('*')` bridge then translated
every event back into a `listener(event)` call inside `create-editor`.
Replace it with a single `Publisher`. The publisher owns the
selection-dedup + focus-flag carve-out (ported verbatim from the relay
machine) and is the only thing `editor.on` reads from. The bridges that
used to forward editor-actor, mutation-actor and sync-actor emissions
into the relay now call `publisher.emit` directly. `Editable` reaches
the publisher through the engine and emits `focused`, `blurred`,
`loading`, `done loading` without touching the actor system.
The relay machine, its React context, and the `actors.relayActor`
handle are gone. The deprecated `'unset'` event (never re-emitted to
consumers anyway) goes with them.
Public behavior is unchanged. The `EditorEmittedEvent` union is the same.
6cc558e to
3071532
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The editor's publication surface — the channel backing
editor.on— was split across three layers: a relay xstate machine that owned selection-dedup and re-emitted everything, actor bridges increate-editor.tsthat forwarded editor-actor / mutation-actor / sync-actor events into the relay, and theEditablecomponent reaching for aRelayActorContextto dispatch lifecycle events directly. OnerelayActor.on('*')bridge then translated every event back into alistener(event)call insidecreate-editor.Replace the relay with a single
Publisher. The publisher owns the selection-dedup + focus-flag carve-out (ported verbatim from the relay machine) and is the only thingeditor.onreads from. The bridges that used to forward into the relay now callpublisher.emitdirectly.Editablereaches the publisher through the engine and emitsfocused,blurred,loading,done loadingwithout touching the actor system.The relay machine, its React context, and the
actors.relayActorhandle are gone. The deprecated'unset'event (never re-emitted to consumers anyway) goes with them.Public behavior
Unchanged.
editor.on(eventType, listener)accepts the same event union, returns the sameSubscriptionshape, and dedupes selection events with the same focus-flag carve-out the relay machine implemented.Verification
editor.onconsumer tests pass on chromium:tests/event.select,tests/focus,tests/behavior-api,tests/event.insert.inline-object,tests/setup,tests/validation,tests/insert-block,tests/self-solvingNo changeset
Pure-internal refactor, no consumer-observable delta.