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

refactor: simplify lifecycle implementation #3863

Merged
merged 1 commit into from
Nov 16, 2023
Merged

Conversation

nolanlawson
Copy link
Contributor

Details

I realized we can simplify the implementation by removing setLifecycleCallbacks entirely and moving everything inside create-custom-element.ts in @lwc/engine-dom. It turns out that all the callback functions we need are already exposed by the @lwc/engine-core package and can be just imported into @lwc/engine-dom.

Tachometer does not report a perf difference between this method and #3862.

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.

@nolanlawson nolanlawson requested a review from a team as a code owner November 16, 2023 20:29
callback(this);
}
};
}
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 also went ahead and DRY'd up this code, although it doesn't turn out to make a perf impact.

@@ -97,6 +98,7 @@ export {
create,
defineProperties,
defineProperty,
entries,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Object.entries is supported in all our supported browsers; we had just never used it before.

Comment on lines +8 to +16
import {
LifecycleCallback,
connectRootElement,
disconnectRootElement,
runFormAssociatedCallback,
runFormDisabledCallback,
runFormResetCallback,
runFormStateRestoreCallback,
} from '@lwc/engine-core';
Copy link
Member

Choose a reason for hiding this comment

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

nice!

@nolanlawson nolanlawson merged commit e1d0336 into jtu/face-fix Nov 16, 2023
3 checks passed
@nolanlawson nolanlawson deleted the nolan/face-fix branch November 16, 2023 23:32
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.

None yet

3 participants