Skip to content

feat(web): add main-thread API: __QuerySelector#2115

Merged
Sherry-hue merged 1 commit intolynx-family:mainfrom
Sherry-hue:feat/main-query-selector
Jan 16, 2026
Merged

feat(web): add main-thread API: __QuerySelector#2115
Sherry-hue merged 1 commit intolynx-family:mainfrom
Sherry-hue:feat/main-query-selector

Conversation

@Sherry-hue
Copy link
Copy Markdown
Collaborator

@Sherry-hue Sherry-hue commented Jan 16, 2026

Summary by CodeRabbit

  • New Features

    • Added __QuerySelector public API to query main-thread UI elements by selector.
  • Improvements

    • Tightened UI method invocation typing to require HTMLElement inputs for improved safety.
  • Tests

    • Added tests and a sample app verifying query-selector-driven scrolling behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 16, 2026

🦋 Changeset detected

Latest commit: 4249c28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@lynx-js/web-constants Patch
@lynx-js/web-mainthread-apis Patch
@lynx-js/web-core-server Patch
@lynx-js/web-core Patch
@lynx-js/web-worker-runtime Patch
upgrade-rspeedy Patch
@lynx-js/web-rsbuild-server-middleware Patch
@lynx-js/web-worker-rpc Patch
@lynx-js/rspeedy Patch
@lynx-js/web-core-wasm Patch
create-rspeedy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

PupilTong
PupilTong previously approved these changes Jan 16, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 9.09091% with 70 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...b-mainthread-apis/ts/createMainThreadGlobalThis.ts 0.00% 70 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

Adds a new main-thread API __QuerySelector, tightens InvokeUIMethodPAPI.element from unknown to HTMLElement, refactors implementations into named constants, updates types, and includes tests and a changeset announcing the feature.

Changes

Cohort / File(s) Summary
Changeset metadata
\.changeset/calm-needles-rule.md
Adds a changeset marking patch releases for @lynx-js/web-constants and @lynx-js/web-mainthread-apis and announces the __QuerySelector feature.
Type definitions
packages/web-platform/web-constants/src/types/MainThreadGlobalThis.ts
Adds QuerySelectorPAPI type, changes InvokeUIMethodPAPI.element from unknown to HTMLElement, and adds __QuerySelector to ElementPAPIs.
API implementation
packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
Extracts __InvokeUIMethod and __QuerySelector into standalone constants, imports related PAPI types, and attaches them to the MainThreadGlobalThis surface.
Tests (spec)
packages/web-platform/web-tests/tests/react.spec.ts
Inserts a "basic-main-query-selector" test case that verifies querying a scroll-view by tag and asserting scrollTop changes after interaction (duplicated in two contexts).
Tests (component)
packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
Adds App component demonstrating use of __QuerySelector via lynx to find a scroll-view and invoke autoScroll on tap.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • PupilTong

Poem

🐇 I hop through DOM and thread, so spry,
I sniff a selector, "Come out, don't hide!"
Types snug like mittens, methods named with care,
A tiny hop, a tap—elements appear! 🎶

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly summarizes the main change: introducing a new main-thread API called __QuerySelector.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sherry-hue Sherry-hue force-pushed the feat/main-query-selector branch from f1212c5 to 4249c28 Compare January 16, 2026 06:15
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx`:
- Around line 40-51: The list items generated by Array.from({ length: 20
}).map((item, index) => ...) lack a React key which causes reconciliation
warnings; update the map callback signature to use (_, index) and add a unique
key prop to the top-level JSX element (the <view> returned by the map) — for
example derive the key from index or a deterministic value — ensuring the key is
applied to <view> so each child in the list has a stable unique key.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1212c5 and 4249c28.

📒 Files selected for processing (5)
  • .changeset/calm-needles-rule.md
  • packages/web-platform/web-constants/src/types/MainThreadGlobalThis.ts
  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
  • packages/web-platform/web-tests/tests/react.spec.ts
  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/web-platform/web-constants/src/types/MainThreadGlobalThis.ts
  • packages/web-platform/web-tests/tests/react.spec.ts
  • .changeset/calm-needles-rule.md
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,jsx,tsx}: Use async/await patterns with proper error handling in JavaScript/TypeScript code
Follow linting rules defined in eslint.config.js including React-specific and TypeScript-specific rules
Additional code quality checks must pass according to biome.jsonc configuration

Files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strictest mode configuration as defined in tsconfig.json

Files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
**/*.{js,ts,jsx,tsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Code must conform to formatting rules defined in .dprint.jsonc configuration

Files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
🧠 Learnings (21)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 2104
File: packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts:820-859
Timestamp: 2026-01-12T08:30:54.996Z
Learning: In packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts, the `element` parameter in `__InvokeUIMethod` is a required parameter that is guaranteed to be provided by the caller, so defensive null/undefined checks are not necessary.
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : In Playwright tests, access Shadow DOM explicitly using `.shadowRoot` when using `evaluate` or `waitForFunction`, as document.querySelector fails to directly access shadow DOM elements
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-core-wasm/AGENTS.md:0-0
Timestamp: 2026-01-04T11:17:24.013Z
Learning: When modifying Rust core logic in src/main_thread, ALWAYS add corresponding tests in tests/element-apis.spec.ts to verify the JS-side behavior
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : Use `boostedQueueMicrotask` for DOM reads/writes to avoid synchronous layout thrashing when accurate layout info isn't immediately needed
📚 Learning: 2026-01-12T08:30:50.992Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 2104
File: packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts:820-859
Timestamp: 2026-01-12T08:30:50.992Z
Learning: In packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts, the element parameter of __InvokeUIMethod is a required parameter guaranteed by the caller. Remove defensive null/undefined checks for element and avoid guarding code paths against undefined for this parameter. Ensure the function and its call sites rely on element being defined, and keep strict null checks in the surrounding code. If there are still any paths that could pass undefined, add explicit validation at the call site rather than inside __InvokeUIMethod.

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : Use `boostedQueueMicrotask` for DOM reads/writes to avoid synchronous layout thrashing when accurate layout info isn't immediately needed

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : Minimize heavy computation in `attributeChangedCallback` as these elements run on the main thread

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : Group DOM updates to minimize layout thrashing in web component implementations

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/htmlTemplates.ts : Define shadow DOM templates in `src/elements/htmlTemplates.ts` for internal structure consistency and encapsulation

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: The `web-elements` package provides a Native UI implementation for the LynxJS Web Platform using Web Components built on the `element-reactive` reactive framework

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-11-06T01:17:10.259Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/tools/DOM/QuerySelector.ts:13-16
Timestamp: 2025-11-06T01:17:10.259Z
Learning: In the Lynx implementation of the Chrome DevTools Protocol, the `nodeId` parameter can be omitted in `DOM.querySelector` and will default to the root node, which differs from the standard CDP specification that requires either `nodeId`, `backendNodeId`, or `objectId`.

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2025-12-30T10:02:35.055Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 2081
File: packages/react/runtime/src/alog/elementPAPICall.ts:109-112
Timestamp: 2025-12-30T10:02:35.055Z
Learning: In packages/react/runtime/src/alog/elementPAPICall.ts, the helper APIs `__GetTag` and `__GetElementUniqueID` should always exist when instrumenting FiberElement PAPIs, so defensive checks for their existence are unnecessary.

Applied to files:

  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{test,spec}.{ts,tsx,js} : For ReactLynx component testing, use testing-library utilities from `packages/react/testing-library/`

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-10-11T06:16:12.517Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1820
File: packages/web-platform/web-tests/tests/react.spec.ts:834-856
Timestamp: 2025-10-11T06:16:12.517Z
Learning: In packages/web-platform/web-tests/tests/react.spec.ts, the tests `basic-bindmouse` and `basic-mts-bindtouchstart` are NOT duplicates despite having similar test structures. They test different event types: `basic-bindmouse` validates mouse events (mousedown, mouseup, mousemove) with mouse-specific properties (button, buttons, x, y, pageX, pageY, clientX, clientY), while `basic-mts-bindtouchstart` validates touch events (touchstart) with touch arrays (touches, targetTouches, changedTouches). The similar test structure is coincidental and follows testing conventions.

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/all.ts : Export new components in `src/elements/all.ts` and add export configuration to `package.json` under `exports` for both types and default

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-11-11T08:05:14.163Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1932
File: packages/web-platform/web-tests/tests/react/basic-element-x-input-ng-bindinput/index.jsx:10-26
Timestamp: 2025-11-11T08:05:14.163Z
Learning: In packages/web-platform/web-tests/tests/react/basic-element-x-input-ng-bindinput/index.jsx, the test intentionally uses selectionStart twice in the result string (instead of selectionStart and selectionEnd) because it prioritizes testing whether x-input-ng works functionally, rather than validating the correctness of selection values.

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : Create a separate spec file for new components (e.g., `tests/x-webview.spec.ts`) instead of adding to the monolithic `web-elements.spec.ts`

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : Use Playwright for all E2E and functional tests with standard assertions like `expect(locator).toBeVisible()`, `expect(locator).toHaveCSS()`, and `diffScreenShot` for screenshot comparisons

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : When creating new elements, inherit from `Element` via `Component` decorator and use reactive utilities provided by `element-reactive`

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{tsx,jsx} : JSX in ReactLynx uses custom Rust-based compiler for transforms rather than standard JSX handling

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx
🧬 Code graph analysis (2)
packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts (1)
packages/web-platform/web-constants/src/types/MainThreadGlobalThis.ts (2)
  • InvokeUIMethodPAPI (321-326)
  • QuerySelectorPAPI (328-331)
packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx (1)
packages/web-platform/web-tests/tests/react/basic-event-trigger/index.jsx (1)
  • text (6-6)
🔇 Additional comments (5)
packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts (4)

65-66: LGTM!

The imports for the new PAPI types are correctly added and align with the type definitions in web-constants.


654-698: LGTM!

The __InvokeUIMethod implementation is well-structured with proper error handling. The special case for boundingClientRect is handled correctly, and the dynamic method invocation pattern with appropriate error codes is sound. Based on learnings, the element parameter is guaranteed by the caller, so no defensive null check is needed here.


700-722: LGTM!

The __QuerySelector implementation correctly:

  • Performs defensive null checking on the input element
  • Lazily augments the queried element with an invoke method only when needed
  • Wraps __InvokeUIMethod in a Promise for a cleaner async API
  • Properly handles error propagation via reject

The pattern of checking !(el as any).invoke before augmentation prevents redundant method attachment on repeated queries for the same element.


892-893: LGTM!

Both new APIs are correctly wired to the MainThreadGlobalThis surface, making them available for main-thread scripts.

packages/web-platform/web-tests/tests/react/basic-main-query-selector/index.jsx (1)

4-11: LGTM!

The handleTap function correctly:

  • Uses the 'main thread' directive to execute on the main thread
  • Queries the scroll-view element using lynx.querySelector
  • Uses optional chaining (?.) for safe method invocation on the potentially null result

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jan 16, 2026

Merging this PR will degrade performance by 6.27%

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 61 untouched benchmarks
⏩ 3 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
basic-performance-small-css 7.7 ms 8.2 ms -6.27%
basic-performance-div-10000 488.5 ms 457.2 ms +6.84%

Comparing Sherry-hue:feat/main-query-selector (4249c28) with main (a7a2ad7)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Jan 16, 2026

Web Explorer

#7195 Bundle Size — 383.77KiB (+0.05%).

4249c28(current) vs a7a2ad7 main#7179(baseline)

Bundle metrics  Change 2 changes
                 Current
#7195
     Baseline
#7179
No change  Initial JS 154.03KiB 154.03KiB
No change  Initial CSS 35.05KiB 35.05KiB
Change  Cache Invalidation 7.38% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 238(-0.42%) 239
No change  Duplicate Modules 16 16
No change  Duplicate Code 3% 3%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#7195
     Baseline
#7179
Regression  JS 251.74KiB (+0.07%) 251.56KiB
No change  Other 96.98KiB 96.98KiB
No change  CSS 35.05KiB 35.05KiB

Bundle analysis reportBranch Sherry-hue:feat/main-query-selec...Project dashboard


Generated by RelativeCIDocumentationReport issue

@Sherry-hue Sherry-hue enabled auto-merge (squash) January 16, 2026 06:35
@Sherry-hue Sherry-hue merged commit 179f984 into lynx-family:main Jan 16, 2026
43 of 46 checks passed
colinaaa pushed a commit that referenced this pull request Jan 25, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/react@0.116.0

### Minor Changes

- **BREAKING CHANGE**: Bump Preact from
[10.24.0](preactjs/preact@1807173)
to
[10.28.0](preactjs/preact@f7693b7),
see diffs at [hzy/preact#6](hzy/preact#6).
([#2042](#2042))

### Patch Changes

- Add safety checks for compilation macros to prevent runtime errors
when they are undefined.
([#2110](#2110))

Replaces direct usage of `__PROFILE__`, `__MAIN_THREAD__`,
`__BACKGROUND__` with `typeof` checks.

This improves robustness by checking variable existence before access,
preventing runtime errors in environments where compilation macros are
not defined.

## @lynx-js/lynx-bundle-rslib-config@0.2.0

### Minor Changes

- Use `LAYERS` exposed by DSL plugins
([#2114](#2114))

## @lynx-js/gesture-runtime@2.1.2

### Patch Changes

- Fix an issue that `NativeGesture` does not get correct types in
callback ([#2130](#2130))

## @lynx-js/rspeedy@0.13.1

### Patch Changes

-   Updated dependencies \[]:
    -   @lynx-js/web-rsbuild-server-middleware@0.19.6

## @lynx-js/react-rsbuild-plugin@0.12.6

### Patch Changes

- Support using `pluginReactLynx` in Rslib.
([#2114](#2114))

- Updated dependencies
\[[`4cd7182`](4cd7182)]:
    -   @lynx-js/template-webpack-plugin@0.10.2
    -   @lynx-js/react-alias-rsbuild-plugin@0.12.6
    -   @lynx-js/use-sync-external-store@1.5.0
    -   @lynx-js/react-refresh-webpack-plugin@0.3.4
    -   @lynx-js/react-webpack-plugin@0.7.3
    -   @lynx-js/css-extract-webpack-plugin@0.7.0

## upgrade-rspeedy@0.13.1

### Patch Changes

- Fix the issue `rslib-runtime.js` was not published in dist folder.
([#2122](#2122))

## @lynx-js/testing-environment@0.1.10

### Patch Changes

- Fix the error "lynxTestingEnv is not defined"
([#2118](#2118))

## @lynx-js/web-constants@0.19.6

### Patch Changes

- feat: add main-thread API: \_\_QuerySelector
([#2115](#2115))

- fix: when a list-item is deleted from list, the deleted list-item is
still showed incorrectly.
([#1092](#1092))

This is because the `enqueueComponent` method does not delete the node
from the Element Tree. It is only to maintain the display node on RL,
and lynx web needs to delete the dom additionally.

- feat: support main thread invoke ui method
([#2104](#2104))

- feat: support lynx.reload()
([#2127](#2127))

- Updated dependencies
\[[`f7133c1`](f7133c1)]:
    -   @lynx-js/web-worker-rpc@0.19.6

## @lynx-js/web-core@0.19.6

### Patch Changes

- fix: avoid crash on CPUs that do not support SIMD
([#2133](#2133))

- feat: support lynx.reload()
([#2127](#2127))

- Updated dependencies
\[[`179f984`](179f984),
[`f7133c1`](f7133c1),
[`6c2b51a`](6c2b51a),
[`556fe9f`](556fe9f),
[`5b589ab`](5b589ab)]:
    -   @lynx-js/web-constants@0.19.6
    -   @lynx-js/web-mainthread-apis@0.19.6
    -   @lynx-js/web-worker-rpc@0.19.6
    -   @lynx-js/web-worker-runtime@0.19.6

## @lynx-js/web-core-wasm@0.0.1

### Patch Changes

- Updated dependencies
\[[`f7133c1`](f7133c1)]:
    -   @lynx-js/web-worker-rpc@0.19.6

## @lynx-js/web-mainthread-apis@0.19.6

### Patch Changes

- feat: add main-thread API: \_\_QuerySelector
([#2115](#2115))

- fix: when a list-item is deleted from list, the deleted list-item is
still showed incorrectly.
([#1092](#1092))

This is because the `enqueueComponent` method does not delete the node
from the Element Tree. It is only to maintain the display node on RL,
and lynx web needs to delete the dom additionally.

- feat: support main thread invoke ui method
([#2104](#2104))

- fix: mts && bts events can be binded both
([#2121](#2121))

- Updated dependencies
\[[`179f984`](179f984),
[`f7133c1`](f7133c1),
[`6c2b51a`](6c2b51a),
[`5b589ab`](5b589ab)]:
    -   @lynx-js/web-constants@0.19.6

## @lynx-js/web-worker-rpc@0.19.6

### Patch Changes

- fix: when a list-item is deleted from list, the deleted list-item is
still showed incorrectly.
([#1092](#1092))

This is because the `enqueueComponent` method does not delete the node
from the Element Tree. It is only to maintain the display node on RL,
and lynx web needs to delete the dom additionally.

## @lynx-js/web-worker-runtime@0.19.6

### Patch Changes

- feat: support lynx.reload()
([#2127](#2127))

- Updated dependencies
\[[`179f984`](179f984),
[`f7133c1`](f7133c1),
[`6c2b51a`](6c2b51a),
[`556fe9f`](556fe9f),
[`5b589ab`](5b589ab)]:
    -   @lynx-js/web-constants@0.19.6
    -   @lynx-js/web-mainthread-apis@0.19.6
    -   @lynx-js/web-worker-rpc@0.19.6

## @lynx-js/template-webpack-plugin@0.10.2

### Patch Changes

- Polyfill `lynx.requireModuleAsync` to allow cache same parallel
requests. ([#2108](#2108))

## create-rspeedy@0.13.1



## @lynx-js/react-alias-rsbuild-plugin@0.12.6



## @lynx-js/web-core-server@0.19.6



## @lynx-js/web-rsbuild-server-middleware@0.19.6

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants