Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): remove PTE connection event handling #7830

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

christianhg
Copy link
Contributor

@christianhg christianhg commented Nov 18, 2024

Currently, PTE emits a connection event whenever it goes offline and online.
However, I don't believe this logic belongs inside PTE:
https://github.com/portabletext/editor/blob/main/packages/editor/src/editor/editor-machine.ts#L41-L60

At the same time, Studio already does an even better job at making sure to mark
fields as readOnly when it detects that it's offline.

@christianhg christianhg requested a review from a team as a code owner November 18, 2024 12:02
@christianhg christianhg requested review from ricokahler and removed request for a team November 18, 2024 12:02
Copy link

vercel bot commented Nov 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 1:24pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 1:24pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 1:24pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 1:24pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 1:24pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Nov 18, 2024 1:24pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Nov 18, 2024

Component Testing Report Updated Nov 18, 2024 1:38 PM (UTC)

❌ Failed Tests (2) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 47s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 32s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ❌ Failed (Inspect) 1m 0s 9 7 2
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 11s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 47s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 46s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 17s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 26s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 36s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

Copy link
Contributor

github-actions bot commented Nov 18, 2024

⚡️ Editor Performance Report

Updated Mon, 18 Nov 2024 13:23:30 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 16.4 efps (61ms) 16.7 efps (60ms) -1ms (-1.6%)
article (body) 61.9 efps (16ms) 56.5 efps (18ms) +2ms (+9.6%)
article (string inside object) 17.9 efps (56ms) 17.9 efps (56ms) +0ms (-/-%)
article (string inside array) 14.9 efps (67ms) 15.0 efps (67ms) -1ms (-0.7%)
recipe (name) 29.4 efps (34ms) 29.4 efps (34ms) +0ms (-/-%)
recipe (description) 33.3 efps (30ms) 33.3 efps (30ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (7ms) 99.9+ efps (6ms) -1ms (-/-%)
synthetic (title) 14.7 efps (68ms) 14.9 efps (67ms) -1ms (-1.5%)
synthetic (string inside object) 14.9 efps (67ms) 15.5 efps (65ms) -3ms (-3.7%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 61ms 66ms 75ms 250ms 555ms 14.9s
article (body) 16ms 20ms 29ms 282ms 423ms 6.0s
article (string inside object) 56ms 58ms 67ms 222ms 318ms 8.5s
article (string inside array) 67ms 70ms 90ms 233ms 941ms 9.6s
recipe (name) 34ms 37ms 57ms 73ms 6ms 9.3s
recipe (description) 30ms 33ms 36ms 62ms 0ms 6.0s
recipe (instructions) 7ms 9ms 10ms 25ms 0ms 3.4s
synthetic (title) 68ms 71ms 80ms 396ms 1525ms 15.0s
synthetic (string inside object) 67ms 74ms 88ms 350ms 1325ms 10.4s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 60ms 66ms 92ms 214ms 497ms 13.8s
article (body) 18ms 20ms 33ms 116ms 313ms 6.2s
article (string inside object) 56ms 58ms 66ms 210ms 330ms 8.3s
article (string inside array) 67ms 72ms 100ms 300ms 1106ms 9.8s
recipe (name) 34ms 37ms 60ms 74ms 1ms 8.6s
recipe (description) 30ms 32ms 36ms 64ms 0ms 6.0s
recipe (instructions) 6ms 8ms 10ms 23ms 0ms 3.4s
synthetic (title) 67ms 72ms 80ms 361ms 1409ms 15.5s
synthetic (string inside object) 65ms 68ms 75ms 446ms 1596ms 10.0s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

Currently, PTE emits a connection event whenever it goes offline and online.
However, I don't believe this logic belongs inside PTE:
https://github.com/portabletext/editor/blob/main/packages/editor/src/editor/editor-machine.ts#L41-L60

At the same time, Studio already does an even better job at making sure to mark
fields as `readOnly` when it detects that it's offline.
@christianhg christianhg added this pull request to the merge queue Nov 18, 2024
Merged via the queue into next with commit 962ca8c Nov 18, 2024
56 of 59 checks passed
@christianhg christianhg deleted the refactor-core-handle-connection-events-locally branch November 18, 2024 13:46
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