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(engine): VM spring cleaning #1893

Merged
merged 4 commits into from
Jun 5, 2020
Merged

refactor(engine): VM spring cleaning #1893

merged 4 commits into from
Jun 5, 2020

Conversation

pmdartus
Copy link
Member

Details

This PR streamlines the VM creations:

  • Removes UninitalizedVM type and only use VM across the engine.
  • Remove unused properties: isRoot, data
  • Centralize all the properties creation in the createVM method: aor, tro.
  • Fix misc typings

Does this PR introduce breaking changes?

  • No, it does not introduce breaking changes.

If yes, please describe the impact and migration path for existing applications.

The PR fulfills these requirements:

  • Have tests for the proposed changes been added? ✅
  • Have you followed these instructions to clearly describe the issue being fixed or feature enhanced? ✅

GUS work item

W-7391508

@pmdartus pmdartus changed the title refactor(engine): vm spring cleaning refactor(engine): VM spring cleaning May 26, 2020
@salesforce-best-lwc-internal

This comment has been minimized.

@salesforce-best-lwc-internal

This comment has been minimized.

@ravijayaramappa
Copy link
Contributor

LGTM, I would like @caridy to also do a pass.

'$$lwc-synthetic-mode$$': true,
} as any);

vm.component = this;
Copy link
Contributor

Choose a reason for hiding this comment

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

for some reason I feel that the association between vm and component should happen before attachShadow, in case that is attempting to do anything with the host, probably ok though. just saying! the fact that vm.cmpRoot is undefined at that point, it probably a good indication that this line is also ok. I think I'm talking myself out of it now! jajaja, I withdraw the concern.

@@ -62,8 +62,8 @@ export function invokeServiceHook(vm: VM, cbs: ServiceCallback[]) {
`Optimize invokeServiceHook() to be invoked only when needed`
);
}
const { component, data, def, context } = vm;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm good with this as it is... but eventually we should just remove all services now that wire reform is in. The services are NOT used by anyone else ATM AFAIK cc @jodarove


import { useSyntheticShadow } from '../../dom/src/env/dom';
export type ShadowDomMode = 'open' | 'closed';
Copy link
Contributor

Choose a reason for hiding this comment

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

TS definition:

interface ShadowRootInit {
    delegatesFocus?: boolean;
    mode: ShadowRootMode;
}

Replace this with ShadowRootMode

import { useSyntheticShadow } from '../../dom/src/env/dom';
export type ShadowDomMode = 'open' | 'closed';

export interface TemplateCache {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not making this a record instead?

Copy link
Contributor

@caridy caridy left a comment

Choose a reason for hiding this comment

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

LGTM... just few nips and notes... overall, looks great.

@ekashida ekashida merged commit 82957ba into master Jun 5, 2020
@ekashida ekashida deleted the pmdartus/vm-cleanup branch June 5, 2020 03:06
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