Skip to content

Commit 375fa8b

Browse files
Revert "fix(custom-elements): hydrate on client side (#5317)" (#6111)
* Revert "fix(custom-elements): hydrate on client side (#5317)" This reverts commit d809658. * remove import
1 parent 7547e18 commit 375fa8b

File tree

3 files changed

+3
-101
lines changed

3 files changed

+3
-101
lines changed

src/compiler/output-targets/dist-custom-elements/custom-elements-build-conditionals.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { isOutputTargetHydrate } from '@utils';
2-
31
import type * as d from '../../../declarations';
42
import { getBuildFeatures, updateBuildConditionals } from '../../app-core/app-data';
3+
54
/**
65
* Get build conditions appropriate for the `dist-custom-elements` Output
76
* Target, including disabling lazy loading and hydration.
@@ -18,10 +17,9 @@ export const getCustomElementsBuildConditionals = (
1817
// then the default in "import { BUILD, NAMESPACE } from '@stencil/core/internal/app-data'"
1918
// needs to have the static build conditionals set for the custom elements build
2019
const build = getBuildFeatures(cmps) as d.BuildConditionals;
21-
const hasHydrateOutputTargets = config.outputTargets.some(isOutputTargetHydrate);
2220

2321
build.lazyLoad = false;
24-
build.hydrateClientSide = hasHydrateOutputTargets;
22+
build.hydrateClientSide = false;
2523
build.hydrateServerSide = false;
2624
build.asyncQueue = config.taskQueue === 'congestionAsync';
2725
build.taskQueue = config.taskQueue !== 'immediate';

src/compiler/output-targets/test/build-conditionals.spec.ts

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { mockConfig, mockLoadConfigInit } from '@stencil/core/testing';
33
import type * as d from '../../../declarations';
44
import { validateConfig } from '../../config/validate-config';
55
import { getCustomElementsBuildConditionals } from '../dist-custom-elements/custom-elements-build-conditionals';
6-
import { getHydrateBuildConditionals } from '../dist-hydrate-script/hydrate-build-conditionals';
76
import { getLazyBuildConditionals } from '../dist-lazy/lazy-build-conditionals';
87

98
describe('build-conditionals', () => {
@@ -16,16 +15,6 @@ describe('build-conditionals', () => {
1615
});
1716

1817
describe('getCustomElementsBuildConditionals', () => {
19-
it('default', () => {
20-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
21-
const bc = getCustomElementsBuildConditionals(config, cmps);
22-
expect(bc).toMatchObject({
23-
lazyLoad: false,
24-
hydrateClientSide: false,
25-
hydrateServerSide: false,
26-
});
27-
});
28-
2918
it('taskQueue async', () => {
3019
userConfig.taskQueue = 'async';
3120
const { config } = validateConfig(userConfig, mockLoadConfigInit());
@@ -60,37 +49,9 @@ describe('build-conditionals', () => {
6049
expect(bc.taskQueue).toBe(true);
6150
expect(config.taskQueue).toBe('async');
6251
});
63-
64-
it('hydrateClientSide true', () => {
65-
const hydrateOutputTarget: d.OutputTargetHydrate = {
66-
type: 'dist-hydrate-script',
67-
};
68-
userConfig.outputTargets = [hydrateOutputTarget];
69-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
70-
const bc = getCustomElementsBuildConditionals(config, cmps);
71-
expect(bc.hydrateClientSide).toBe(true);
72-
});
73-
74-
it('hydratedSelectorName', () => {
75-
userConfig.hydratedFlag = {
76-
name: 'boooop',
77-
};
78-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
79-
const bc = getCustomElementsBuildConditionals(config, cmps);
80-
expect(bc.hydratedSelectorName).toBe('boooop');
81-
});
8252
});
8353

8454
describe('getLazyBuildConditionals', () => {
85-
it('default', () => {
86-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
87-
const bc = getLazyBuildConditionals(config, cmps);
88-
expect(bc).toMatchObject({
89-
lazyLoad: true,
90-
hydrateServerSide: false,
91-
});
92-
});
93-
9455
it('taskQueue async', () => {
9556
userConfig.taskQueue = 'async';
9657
const { config } = validateConfig(userConfig, mockLoadConfigInit());
@@ -138,61 +99,5 @@ describe('build-conditionals', () => {
13899
const bc = getLazyBuildConditionals(config, cmps);
139100
expect(bc.transformTagName).toBe(true);
140101
});
141-
142-
it('hydrateClientSide default', () => {
143-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
144-
const bc = getLazyBuildConditionals(config, cmps);
145-
expect(bc.hydrateClientSide).toBe(false);
146-
});
147-
148-
it('hydrateClientSide true', () => {
149-
const hydrateOutputTarget: d.OutputTargetHydrate = {
150-
type: 'dist-hydrate-script',
151-
};
152-
userConfig.outputTargets = [hydrateOutputTarget];
153-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
154-
const bc = getLazyBuildConditionals(config, cmps);
155-
expect(bc.hydrateClientSide).toBe(true);
156-
});
157-
158-
it('hydratedSelectorName', () => {
159-
userConfig.hydratedFlag = {
160-
name: 'boooop',
161-
};
162-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
163-
const bc = getLazyBuildConditionals(config, cmps);
164-
expect(bc.hydratedSelectorName).toBe('boooop');
165-
});
166-
});
167-
168-
describe('getHydrateBuildConditionals', () => {
169-
it('hydratedSelectorName', () => {
170-
userConfig.hydratedFlag = {
171-
name: 'boooop',
172-
};
173-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
174-
const bc = getHydrateBuildConditionals(config, cmps);
175-
expect(bc.hydratedSelectorName).toBe('boooop');
176-
});
177-
178-
it('should allow setting to use a class for hydration', () => {
179-
userConfig.hydratedFlag = {
180-
selector: 'class',
181-
};
182-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
183-
const bc = getHydrateBuildConditionals(config, cmps);
184-
expect(bc.hydratedClass).toBe(true);
185-
expect(bc.hydratedAttribute).toBe(false);
186-
});
187-
188-
it('should allow setting to use an attr for hydration', () => {
189-
userConfig.hydratedFlag = {
190-
selector: 'attribute',
191-
};
192-
const { config } = validateConfig(userConfig, mockLoadConfigInit());
193-
const bc = getHydrateBuildConditionals(config, cmps);
194-
expect(bc.hydratedClass).toBe(false);
195-
expect(bc.hydratedAttribute).toBe(true);
196-
});
197102
});
198103
});

src/runtime/initialize-component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ export const initializeComponent = async (
3232
// Let the runtime know that the component has been initialized
3333
hostRef.$flags$ |= HOST_FLAGS.hasInitializedComponent;
3434

35-
const bundleId = cmpMeta.$lazyBundleId$;
36-
if ((BUILD.lazyLoad || BUILD.hydrateClientSide) && bundleId) {
35+
if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
3736
// lazy loaded components
3837
// request the component's implementation to be
3938
// wired up with the host element

0 commit comments

Comments
 (0)