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

fix(es/decorators): Fix init order of 2022-03 impl #9760

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

jzhan-canva
Copy link
Contributor

@jzhan-canva jzhan-canva commented Nov 26, 2024

Description:
Fix the order of initialization for 2022-03 decorators.
TBH the proposal isn't very clear on how init is executed for auto-accessor decorator

Related issue:

Copy link

changeset-bot bot commented Nov 26, 2024

🦋 Changeset detected

Latest commit: c5de65c

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

@CLAassistant
Copy link

CLAassistant commented Nov 26, 2024

CLA assistant check
All committers have signed the CLA.

@jzhan-canva
Copy link
Contributor Author

@kdy1 please take a look on this draft

@kdy1 kdy1 self-assigned this Nov 26, 2024
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

Are you sure that this order change belongs to 2022-03 decorators?

I'm asking because the next version has initializer order reversed.

@jzhan-canva
Copy link
Contributor Author

the only thing I changed in this PR is to move _init_proto to before field initialization, I didn't change any logic of how _init_proto calls each initializer internally

I can double check the 2022-03 specification

Copy link

codspeed-hq bot commented Nov 26, 2024

CodSpeed Performance Report

Merging #9760 will degrade performances by 4.42%

Comparing jzhan-canva:jzhan-2022deco-order (c5de65c) with main (2d6f9a5)

Summary

❌ 2 regressions
✅ 203 untouched benchmarks

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

Benchmarks breakdown

Benchmark main jzhan-canva:jzhan-2022deco-order Change
es/minifier/libs/lodash 214.7 ms 223.9 ms -4.12%
es/minifier/libs/moment 98.4 ms 102.9 ms -4.42%

@jzhan-canva jzhan-canva marked this pull request as ready for review November 26, 2024 08:05
@jzhan-canva jzhan-canva requested a review from a team as a code owner November 26, 2024 08:05
@jzhan-canva jzhan-canva requested a review from kdy1 November 26, 2024 08:05
@jzhan-canva jzhan-canva marked this pull request as draft November 26, 2024 08:07
@jzhan-canva jzhan-canva marked this pull request as ready for review November 26, 2024 12:19
@jzhan-canva
Copy link
Contributor Author

I misunderstood the unit test, now it's fixed

Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

Can you add some tests?

@jzhan-canva
Copy link
Contributor Author

Can you add some tests?
will do

another question @kdy1, does swc have corporate CLA that my employer can sign?

@kdy1
Copy link
Member

kdy1 commented Nov 27, 2024

No, but I don’t think signing is necessary for this changes. I’m not going to monetize SWC or change license forever. I just want to be free while moving source codes in GitHub. I moved plugin codes from vercel/next.js to swc-project/plugins, and some npm packages within swc org, but that’s all.

@kdy1 kdy1 assigned kdy1 and unassigned kdy1 Jan 14, 2025
@kdy1 kdy1 added this to the Planned milestone Jan 14, 2025
@kdy1 kdy1 requested a review from a team as a code owner January 15, 2025 06:57
@kdy1 kdy1 changed the title Fix 2022-03 decorators initialization order fix(es/decorators): Fix init order of 2022-03 impl Jan 15, 2025
@kdy1 kdy1 enabled auto-merge (squash) January 15, 2025 06:59
@kdy1 kdy1 merged commit 751a310 into swc-project:main Jan 15, 2025
167 checks passed
@kdy1 kdy1 modified the milestones: Planned, 1.10.8 Jan 19, 2025
@swc-project swc-project locked as resolved and limited conversation to collaborators Feb 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] 2022-03 decorator initialise class instance in wrong order
3 participants