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

feat(versioning): use native custom element lifecycle #3352

Closed
wants to merge 1 commit into from

Conversation

nolanlawson
Copy link
Contributor

@nolanlawson nolanlawson commented Feb 17, 2023

Details

This is a 4-part PR.

Part 1: basic scaffolding for versioning (#3350)
Part 2: using it in the template compiler (#3351)
Part 3: using it in the runtime (this PR)
Part 4: using it in the Babel plugin (#3354)

I decided to fix #3198 as an example of using API versioning in the client side. Here we have a version number associated with a compiled component, and then individual components may run with native custom element lifecycle or not.

I also went ahead and modified the Karma tests to run with different API versions: API_VERSION=59 yarn test. I think this is simpler than using individual feature flags anyway.

Fixes #3198

Does this pull request introduce a breaking change?

  • ✅ No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • ✅ No, it does not introduce an observable change.

GUS work item

W-12566318

@nolanlawson
Copy link
Contributor Author

nolanlawson commented Feb 17, 2023

TODO: I should probably add Karma tests for having mixed v58 and v59 components in the same tree, and confirm that they can use synthetic vs native lifecycle independent of each other.

Edit: added the test, and good thing I did! There was a bug when you had mixed API versions between parent and child components. 😅

type: boolean
default: false
default: true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would love to use the integer type here, but I could not get it to work, and I figured there's little point in debugging Circle CI oddities since we may move away from Circle CI anyway.


// Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
// See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I'm doing here is a known perf regression (adding the connectedCallback / disconnectedCallback to the prototype). But there is no other way to solve this, so this is just a hit we have to take.

We may be able to solve the perf regression if we do #3202 someday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/api-versioning Adding API versioning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant