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

chore: change locker support flag for clarity #5163

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@lwc/engine-core/src/framework/invoker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function invokeComponentConstructor(vm: VM, Ctor: LightningElementConstru
// the "instanceof" operator would not work here since Locker Service provides its own
// implementation of LightningElement, so we indirectly check if the base constructor is
// invoked by accessing the component on the vm.
const isInvalidConstructor = lwcRuntimeFlags.ENABLE_LEGACY_LOCKER_SUPPORT
const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
? vmBeingConstructed.component !== result
: !(result instanceof LightningElement);

Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/features/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const features: FeatureFlagMap = {
ENABLE_FORCE_SHADOW_MIGRATE_MODE: null,
ENABLE_EXPERIMENTAL_SIGNALS: null,
DISABLE_SYNTHETIC_SHADOW: null,
ENABLE_LEGACY_LOCKER_SUPPORT: null,
LEGACY_LOCKER_ENABLED: null,
};

if (!(globalThis as any).lwcRuntimeFlags) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/features/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface FeatureFlagMap {
* If true, then lightning legacy locker is supported, otherwise lightning legacy locker will not function
* properly.
*/
ENABLE_LEGACY_LOCKER_SUPPORT: FeatureFlagValue;
LEGACY_LOCKER_ENABLED: FeatureFlagValue;
}

export type FeatureFlagName = keyof FeatureFlagMap;
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ describe.runIf(process.env.NATIVE_SHADOW)('native shadow', () => {

describe('locker integration', () => {
beforeEach(() => {
setFeatureFlagForTest('ENABLE_LEGACY_LOCKER_SUPPORT', true);
setFeatureFlagForTest('LEGACY_LOCKER_ENABLED', true);
});
afterEach(() => {
setFeatureFlagForTest('ENABLE_LEGACY_LOCKER_SUPPORT', false);
setFeatureFlagForTest('LEGACY_LOCKER_ENABLED', false);
});
it('should support component class that extend a mirror of the LightningElement', () => {
function SecureBaseClass() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import LockerIntegration from 'x/lockerIntegration';
import LockerLiveComponent from 'x/lockerLiveComponent';
import LockerHooks, { hooks } from 'x/lockerHooks';
beforeEach(() => {
setFeatureFlagForTest('ENABLE_LEGACY_LOCKER_SUPPORT', true);
setFeatureFlagForTest('LEGACY_LOCKER_ENABLED', true);
});
afterEach(() => {
setFeatureFlagForTest('ENABLE_LEGACY_LOCKER_SUPPORT', false);
setFeatureFlagForTest('LEGACY_LOCKER_ENABLED', false);
});
it('should support Locker integration which uses a wrapped LightningElement base class', () => {
const elm = createElement('x-secure-parent', { is: LockerIntegration });
Expand Down