Skip to content

Conversation

@Varixo
Copy link
Member

@Varixo Varixo commented Nov 14, 2025

Make props proxy more reactive by adding effects for var props like a store.

@Varixo Varixo self-assigned this Nov 14, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

🦋 Changeset detected

Latest commit: 86e3a98

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

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

@Varixo Varixo changed the title V2 reactive var props feat: reactive var props Nov 14, 2025
@Varixo Varixo force-pushed the v2-reactive-var-props branch from 577abec to 56454b0 Compare November 14, 2025 15:37
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8156
npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8156
npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8156
npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8156

commit: 5746b46

@github-actions
Copy link
Contributor

github-actions bot commented Nov 14, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 5746b46

let propsAreDifferent = false;
if (vNodeProps) {
const effects = vNodeProps[_PROPS_HANDLER].$effects$;
const constPropsDifferent = handleChangedProps(
Copy link
Member

Choose a reason for hiding this comment

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

let's only do this if the key is different

Copy link
Member Author

Choose a reason for hiding this comment

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

but to know if key is changed we need to run it anyway

// to this signal.
ensureContainsBackRef(effectSubscription, target);
addQrlToSerializationCtx(effectSubscription, store.$container$);
addQrlToSerializationCtx(effectSubscription, '$container$' in store ? store.$container$ : null);
Copy link
Member

Choose a reason for hiding this comment

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

add a comment here to say it's to avoid subscribing?

const owner = value[_OWNER];
output(TypeIds.PropsProxy, [_serializationWeakRef(owner), owner.varProps, owner.constProps]);
output(TypeIds.PropsProxy, [
_serializationWeakRef(owner),
Copy link
Member

Choose a reason for hiding this comment

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

I think we should take this out, and instead add a _serializationWeakRef(propsProxy) to jsxNode, and do propsProxy.owner = jsxNode in inflate of jsxNode

Copy link
Member Author

Choose a reason for hiding this comment

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

you cant have varprops and const props without owner, so how we can inflate propsproxy then?

Copy link
Member

Choose a reason for hiding this comment

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

hmm ok to fix this we have to move ownership of the props to propsproxy, as soon as it is created. But we shouldn't create it for every jsxnode so we must support both paths.

I think that can go in another PR.

@Varixo Varixo force-pushed the v2-reactive-var-props branch from a05bcd7 to 5746b46 Compare November 15, 2025 08:27
Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

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

LGTM

@Varixo Varixo marked this pull request as ready for review November 15, 2025 09:39
@Varixo Varixo requested a review from a team as a code owner November 15, 2025 09:39
@Varixo Varixo merged commit 1fb75e7 into build/v2 Nov 15, 2025
15 checks passed
@Varixo Varixo deleted the v2-reactive-var-props branch November 15, 2025 09:40
@Varixo Varixo moved this from Done to Waiting For Review in Qwik Development Nov 15, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Qwik Development Nov 15, 2025
@Varixo Varixo moved this from Waiting For Review to Done in Qwik Development Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[🐞] V2 Reactivity issues [🐞] [v2] Props should be reactive

3 participants