Skip to content

Conversation

@colinaaa
Copy link
Collaborator

@colinaaa colinaaa commented Jul 8, 2025

Summary

Integrate with preact/debug.

A new exports @lynx-js/react/debug has been added.

import '@lynx-js/react/debug';
import { root } from '@lynx-js/react';

import { App } from './App.jsx';

root.render(
  <App />,
);

close: m-6732088176

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@changeset-bot
Copy link

changeset-bot bot commented Jul 8, 2025

🦋 Changeset detected

Latest commit: 1dc889d

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

This PR includes changesets to release 6 packages
Name Type
create-rspeedy Patch
@lynx-js/react Patch
@lynx-js/react-alias-rsbuild-plugin Patch
@lynx-js/react-rsbuild-plugin Patch
upgrade-rspeedy Patch
@lynx-js/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

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 8, 2025

CodSpeed Performance Report

Merging #1250 will not alter performance

Comparing colinaaa:colin/0708/debug (1dc889d) with main (b0765ae)

Summary

✅ 10 untouched benchmarks

@relativeci
Copy link

relativeci bot commented Jul 8, 2025

Web Explorer

#2714 Bundle Size — 259.2KiB (0%).

1dc889d(current) vs b0765ae main#2703(baseline)

Bundle metrics  Change 1 change
                 Current
#2714
     Baseline
#2703
No change  Initial JS 141.05KiB 141.05KiB
No change  Initial CSS 31.88KiB 31.88KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 4 4
No change  Assets 4 4
Change  Modules 209(-0.48%) 210
No change  Duplicate Modules 17 17
No change  Duplicate Code 4.15% 4.15%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#2714
     Baseline
#2703
No change  JS 227.32KiB 227.32KiB
No change  CSS 31.88KiB 31.88KiB

Bundle analysis reportBranch colinaaa:colin/0708/debugProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Jul 8, 2025

React Example

#2723 Bundle Size — 234.18KiB (+0.03%).

1dc889d(current) vs b0765ae main#2712(baseline)

Bundle metrics  Change 3 changes Regression 1 regression
                 Current
#2723
     Baseline
#2712
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 37.74% 0%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 155(+1.31%) 153
Regression  Duplicate Modules 62(+1.64%) 61
No change  Duplicate Code 45.85% 45.85%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#2723
     Baseline
#2712
No change  IMG 145.76KiB 145.76KiB
Regression  Other 88.43KiB (+0.07%) 88.37KiB

Bundle analysis reportBranch colinaaa:colin/0708/debugProject dashboard


Generated by RelativeCIDocumentationReport issue

@colinaaa colinaaa marked this pull request as ready for review July 8, 2025 13:49
@colinaaa colinaaa requested review from Yradex, hzy and upupming July 8, 2025 13:49
@colinaaa
Copy link
Collaborator Author

colinaaa commented Jul 8, 2025

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ BugBot reviewed your changes and found no bugs!


BugBot free trial expires on July 22, 2025
You have used $0.00 of your $0.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Collaborator

@upupming upupming left a comment

Choose a reason for hiding this comment

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

Do we need some test case to ensure preact/debug work as expected?

@colinaaa colinaaa added this pull request to the merge queue Jul 18, 2025
Merged via the queue into lynx-family:main with commit ec7228f Jul 18, 2025
41 of 44 checks passed
@colinaaa colinaaa deleted the colin/0708/debug branch July 18, 2025 04:38
colinaaa pushed a commit that referenced this pull request Jul 19, 2025
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/[email protected]

### Patch Changes

- Optimize `componentAtIndex` by a few hundreds microseconds: avoiding
manipulate `__pendingListUpdates` unless SnapshotInstance tree is
changed ([#1201](#1201))

- Support alog of component rendering on production for better error
reporting. Enable it by using `REACT_ALOG=true rspeedy dev/build` or
defining `__ALOG__` to `true` in `lynx.config.js`:
([#1164](#1164))

    ```js
    export default defineConfig({
      // ...
      source: {
        define: {
          __ALOG__: true,
        },
      },
    });
    ```

- Make `preact/debug` work with `@lynx-js/react`.
([#1222](#1222))

- Introduce `@lynx-js/react/debug` which would include debugging
warnings and error messages for common mistakes found.
([#1250](#1250))

Add the import to `@lynx-js/react/debug` at the first line of the entry:

    ```js
    import "@lynx-js/react/debug";
    import { root } from "@lynx-js/react";

    import { App } from "./App.jsx";

    root.render(<App />);
    ```

- `<list-item/>` deferred now accepts an object with `unmountRecycled`
property to control unmounting behavior when the item is recycled.
([#1302](#1302))

    For example, you can use it like this:

    ```jsx
    <list-item defer={{ unmountRecycled: true }} item-key="1">
      <WillBeUnmountIfRecycled />
    </list-item>
    ```

Now the component will be unmounted when it is recycled, which can help
with performance in certain scenarios.

- Avoid some unexpected `__SetAttribute` in hydrate when `undefined` is
passed as an attribute value to intrinsic elements, for example:
([#1318](#1318))

    ```jsx
    <image async-mode={undefined} />
    ```

## @lynx-js/[email protected]

### Patch Changes

- Bump Rsbuild v1.4.6 with Rspack v1.4.8.
([#1282](#1282))

## [email protected]

### Patch Changes

- Add `import '@lynx-js/react/debug'` for all templates.
([#1250](#1250))

## @lynx-js/[email protected]

### Patch Changes

- Fix "TypeError: cannot read property 'call' of undefined" error during
HMR updates.
([#1304](#1304))

- Supports extractStr for large JSON
([#1230](#1230))

- Change `extractStr` to `false` when `performance.chunkSplit.strategy`
is not `all-in-one`.
([#1251](#1251))

- Updated dependencies
\[[`cb7feb6`](cb7feb6),
[`ec7228f`](ec7228f)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Support `@lynx-js/react/debug`.
([#1250](#1250))

## @lynx-js/[email protected]

### Patch Changes

- Support alog of component rendering on production for better error
reporting. Enable it by using `REACT_ALOG=true rspeedy dev/build` or
defining `__ALOG__` to `true` in `lynx.config.js`:
([#1164](#1164))

    ```js
    export default defineConfig({
      // ...
      source: {
        define: {
          __ALOG__: true,
        },
      },
    });
    ```

- Supports `console.alog` and use different `console` object in main
thread and background thread.
([#1164](#1164))

## @lynx-js/[email protected]

### Patch Changes

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: support \_\_MarkTemplateElement, \_\_MarkPartElement and
\_\_GetTemplateParts for all-on-ui
([#1275](#1275))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support SSR for all-on-ui
([#1029](#1029))

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: support \_\_MarkTemplateElement, \_\_MarkPartElement and
\_\_GetTemplateParts for all-on-ui
([#1275](#1275))

- feat: mark template elements for SSR and update part ID handling
([#1286](#1286))

- Updated dependencies
\[[`cebda59`](cebda59),
[`1443e46`](1443e46),
[`5062128`](5062128),
[`f656b7f`](f656b7f)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support SSR for all-on-ui
([#1029](#1029))

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: dump the event info on ssr stage
([#1237](#1237))

- feat: mark template elements for SSR and update part ID handling
([#1286](#1286))

## @lynx-js/[email protected]

### Patch Changes

- fix: indicator dots' bg-color on safari 26
([#1298](#1298))

    <https://bugs.webkit.org/show_bug.cgi?id=296048>
    The animation name should be defined in the template

- fix: list may only render only one column in ReactLynx.
([#1280](#1280))

This is because `span-count` may not be specified when `list-type` is
specified, resulting in layout according to `span-count="1"`. Postponing
the acquisition of `span-count` until layoutListItem can solve this
problem.

- Updated dependencies
\[[`443f3d5`](443f3d5)]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- fix: indicator dots' bg-color on safari 26
([#1298](#1298))

    <https://bugs.webkit.org/show_bug.cgi?id=296048>
    The animation name should be defined in the template

## @lynx-js/[email protected]

### Patch Changes

- feat: support SSR for all-on-ui
([#1029](#1029))

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: support \_\_MarkTemplateElement, \_\_MarkPartElement and
\_\_GetTemplateParts for all-on-ui
([#1275](#1275))

- feat: mark template elements for SSR and update part ID handling
([#1286](#1286))

- Updated dependencies
\[[`1443e46`](1443e46),
[`5062128`](5062128)]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Updated dependencies
\[[`cebda59`](cebda59),
[`1443e46`](1443e46),
[`5062128`](5062128),
[`f656b7f`](f656b7f)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Fix the `Syntax Error: expecting ';'` error of chunk splitting
([#1279](#1279))

## [email protected]



## @lynx-js/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@plesiecki
Copy link

plesiecki commented Jul 29, 2025

What would you say to injecting @lynx-js/react/debug automatically only for the dev build instead of introducing more boilerplate code?

@colinaaa
Copy link
Collaborator Author

What would you say to injecting @lynx-js/react/debug automatically only for the dev build instead of introducing more boilerplate code?

We've already done that. We have an alias from @lynx-js/react/debug to false in production.

if (isProd) {
chain.resolve.alias.set('@lynx-js/react/debug$', false)
}

This bundle size regression (88.37KiB -> 88.43KiB (+0.07%)) in this PR would be optimized after web-infra-dev/rspack#10954 is landed.

In short, the import '@lynx-js/react/debug' should not have any effect to the production bundle size.

@plesiecki
Copy link

plesiecki commented Jul 29, 2025

Sorry, by the boilerplate code I actually meant the source code here #1250 (comment). The automatic injection in the dev mode would mean no import of the @lynx-js/react/debug module at all in the source code.

@colinaaa
Copy link
Collaborator Author

Sorry, by the boilerplate code I actually meant the source code here #1250 (comment). The automatic injection in the dev mode would mean no import of the @lynx-js/react/debug module at all in the source code.

This is what @preact/preset-vite does (https://github.com/preactjs/preset-vite/blob/779adf917991716532225eb6a6f029ad2df14a96/src/devtools.ts#L66) and we may want to do the same thing in the future.

But for now, we would like to make it opt-in so that it could be disabled when having problems.

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.

4 participants