Skip to content

Conversation

@EoinFalconer
Copy link
Contributor

Description

Fixes an issue where the Enhanced Object Dialog would instantly close when clicking on array items that have deterministic keys containing periods (e.g., object.key or v1.0.0).

Root Cause

The parseGradientPath function in path.ts used a simple regex split on [, ., and ] characters:

.split(/[[.\]]/g)

This incorrectly splits periods that appear inside quoted key values. For example:

  • Input: array[_key=="object.key"]
  • Result: ['array', '_key=="object', 'key"']
  • Expected: ['array', {_key: 'object.key'}]

Solution

Replaced the regex-based split with a proper tokenizer that:

  1. Tracks quote state (single and double quotes)
  2. Only splits on . when outside of brackets and quotes
  3. Preserves periods inside quoted key values

Testing

Added comprehensive test coverage for path.ts including:

  • Simple paths
  • Paths with array indices
  • Paths with key segments
  • Paths with keys containing periods (the bug case)
  • Roundtrip encode/decode tests

Checklist

  • Bug fix
  • Tests added
  • No breaking changes

Fixes SAPP-3481

When using deterministic keys with periods (e.g., 'object.key' or 'v1.0.0'),
the Enhanced Object Dialog would instantly close because the path parser
incorrectly split on periods inside quoted strings.

The fix replaces the simple regex-based split with a proper tokenizer that
tracks quote state, ensuring periods inside quoted key values are preserved.

Fixes SAPP-3481
@vercel
Copy link

vercel bot commented Feb 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
page-building-studio Ready Ready Preview, Comment Feb 7, 2026 1:00pm
test-studio Ready Ready Preview, Comment Feb 7, 2026 1:00pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio-workshop Ignored Ignored Preview Feb 7, 2026 1:00pm
test-next-studio Ignored Ignored Feb 7, 2026 1:00pm

Request Review

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

🧪 E2E Preview environment

🔑 Environment Variables for Local Testing

This is the preview URL for the E2E tests: https://e2e-studio-9lvj3ifgk.sanity.dev

To run the E2E tests locally, you can use the following environment variables, then run pnpm test:e2e --ui to open the Playwright test runner.

💬 Remember to build the project first with pnpm build:e2e.

  SANITY_E2E_PROJECT_ID=ittbm412
  SANITY_E2E_BASE_URL=https://e2e-studio-9lvj3ifgk.sanity.dev
  SANITY_E2E_DATASET="update depending the project you want to test (pr-12110-chromium-21780438060 || pr-12110-firefox-21780438060 )"
  SANITY_E2E_DATASET_CHROMIUM=pr-12110-chromium-21780438060
  SANITY_E2E_DATASET_FIREFOX=pr-12110-firefox-21780438060

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

📊 Playwright Test Report

Download Full E2E Report

This report contains test results, including videos of failing tests.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

📚 TypeDoc Generation Result

TypeDoc generated successfully!

  • File size: 8.0M
  • Total exports: 1051
  • Artifact: sanity-typedoc-09cd1bad30e7c5881d0be85b0b3fc43f8d727edc

The TypeDoc JSON file has been generated and validated. All documentation scripts completed successfully.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

⚡️ Editor Performance Report

Updated Sat, 07 Feb 2026 13:07:47 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 30.3 efps (33ms) 27.8 efps (36ms) +3ms (+9.1%)
article (body) 43.9 efps (23ms) 36.7 efps (27ms) +4ms (+19.5%)
article (string inside object) 37.7 efps (27ms) 35.7 efps (28ms) +2ms (+5.7%)
article (string inside array) 35.7 efps (28ms) 45.5 efps (22ms) -6ms (-21.4%)
recipe (name) 99.9+ efps (10ms) 99.9+ efps (10ms) +0ms (-/-%)
recipe (description) 52.6 efps (19ms) 52.6 efps (19ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (6ms) +1ms (-/-%)
singleString (stringField) 99.9+ efps (5ms) 99.9+ efps (6ms) +1ms (-/-%)
synthetic (title) 58.8 efps (17ms) 58.8 efps (17ms) +0ms (-/-%)
synthetic (string inside object) 66.7 efps (15ms) 52.6 efps (19ms) +4ms (+26.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) 33ms 46ms 56ms 101ms 55ms 8.4s
article (body) 23ms 29ms 48ms 132ms 304ms 5.9s
article (string inside object) 27ms 36ms 52ms 63ms 19ms 6.8s
article (string inside array) 28ms 38ms 52ms 66ms 47ms 7.3s
recipe (name) 10ms 12ms 14ms 46ms 0ms 5.2s
recipe (description) 19ms 22ms 23ms 47ms 0ms 4.4s
recipe (instructions) 5ms 8ms 9ms 11ms 0ms 3.0s
singleString (stringField) 5ms 8ms 10ms 19ms 0ms 4.3s
synthetic (title) 17ms 21ms 26ms 90ms 1174ms 9.0s
synthetic (string inside object) 15ms 18ms 23ms 85ms 804ms 8.2s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 36ms 41ms 60ms 114ms 114ms 8.4s
article (body) 27ms 36ms 59ms 113ms 353ms 6.5s
article (string inside object) 28ms 39ms 53ms 61ms 21ms 6.8s
article (string inside array) 22ms 28ms 51ms 65ms 1ms 6.7s
recipe (name) 10ms 12ms 14ms 30ms 0ms 5.1s
recipe (description) 19ms 22ms 28ms 53ms 0ms 4.4s
recipe (instructions) 6ms 10ms 12ms 17ms 0ms 3.1s
singleString (stringField) 6ms 9ms 10ms 23ms 0ms 4.3s
synthetic (title) 17ms 20ms 28ms 109ms 1276ms 9.2s
synthetic (string inside object) 19ms 25ms 50ms 97ms 1213ms 9.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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 31.05% 17624 / 56760
🔵 Statements 27.51% 21943 / 79736
🔵 Functions 30.32% 3359 / 11075
🔵 Branches 20.66% 14132 / 68398
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/form/utils/path.ts 100% 96.55% 100% 100%
Generated in workflow #51811 for commit 3847c0d by the Vitest Coverage Report Action

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.

1 participant