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

Fix double rendering of renovated components in ssr mode angular #28757

Open
wants to merge 1 commit into
base: 24_2
Choose a base branch
from
Open
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/devextreme-angular/karma.test.shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ testing.TestBed.initTestEnvironment(
browser.platformBrowserDynamicTesting(),
);

const context = require.context('./tests/dist', true, /^.\/(?!.*\/ssr-components\.spec.js$).*\.spec\.js$/);
const context = require.context('./tests/dist', true, /^.\/(?!.*\/(ssr-components|hydration)\.spec\.js$).*\.spec\.js$/);
context.keys().map(context);
__karma__.start();
12 changes: 9 additions & 3 deletions packages/devextreme-angular/src/server/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ export class DxServerModule {
const el = infernoRenderer.createElement(component, props);
const document = container.ownerDocument;
const temp = document.createElement(container.tagName);

temp.innerHTML = renderToString(el);

const mainElement = temp.childNodes[0];
const childString = mainElement.innerHTML;

for (let i = 0; i < mainElement.attributes.length; i++) {
temp.setAttribute(mainElement.attributes[i].name, mainElement.attributes[i].value);
const attr = mainElement.attributes[i];

if (!container.hasAttribute(attr.name)) {
container.setAttribute(attr.name, attr.value);
}
}
temp.innerHTML = childString;
container.outerHTML = temp.outerHTML;

container.innerHTML = childString;
},
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/accordion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { DxiAccordionItemComponent } from 'devextreme-angular/ui/accordion/neste
@Component({
selector: 'dx-accordion',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/action-sheet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { DxiActionSheetItemComponent } from 'devextreme-angular/ui/action-sheet/
@Component({
selector: 'dx-action-sheet',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-autocomplete',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/bar-gauge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import { DxoBarGaugeTooltipBorderModule } from 'devextreme-angular/ui/bar-gauge/
selector: 'dx-bar-gauge',
template: '',
styles: [ ' :host { display: block; }'],
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { DxiBoxItemComponent } from 'devextreme-angular/ui/box/nested';
@Component({
selector: 'dx-box',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/bullet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { DxoBulletTooltipModule } from 'devextreme-angular/ui/bullet/nested';
selector: 'dx-bullet',
template: '',
styles: [ ' :host { display: block; }'],
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/button-group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { DxiButtonGroupItemComponent } from 'devextreme-angular/ui/button-group/
@Component({
selector: 'dx-button-group',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
@Component({
selector: 'dx-button',
template: '<ng-content></ng-content>',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/calendar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-calendar',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ import { DxiChartValueAxisComponent } from 'devextreme-angular/ui/chart/nested';
selector: 'dx-chart',
template: '',
styles: [ ' :host { display: block; }'],
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/chat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { DxiChatTypingUserComponent } from 'devextreme-angular/ui/chat/nested';
@Component({
selector: 'dx-chat',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/check-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-check-box',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/circular-gauge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import { DxoCircularGaugeValueIndicatorModule } from 'devextreme-angular/ui/circ
selector: 'dx-circular-gauge',
template: '',
styles: [ ' :host { display: block; }'],
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/color-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-color-box',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/context-menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import { DxiContextMenuItemComponent } from 'devextreme-angular/ui/context-menu/
@Component({
selector: 'dx-context-menu',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/data-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ import { DxiDataGridSortByGroupSummaryInfoComponent } from 'devextreme-angular/u
@Component({
selector: 'dx-data-grid',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/date-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-date-box',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/date-range-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-date-range-box',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { DxoDeferRenderingToModule } from 'devextreme-angular/ui/defer-rendering
@Component({
selector: 'dx-defer-rendering',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/diagram/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import { DxiDiagramCustomShapeComponent } from 'devextreme-angular/ui/diagram/ne
@Component({
selector: 'dx-diagram',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/draggable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { DxoDraggableCursorOffsetModule } from 'devextreme-angular/ui/draggable/
@Component({
selector: 'dx-draggable',
template: '<ng-content></ng-content>',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/drawer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
@Component({
selector: 'dx-drawer',
template: '<ng-content></ng-content>',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/drop-down-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-drop-down-box',
template: '<ng-content></ng-content>',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import { DxiDropDownButtonItemComponent } from 'devextreme-angular/ui/drop-down-
@Component({
selector: 'dx-drop-down-button',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/file-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import { DxoFileManagerUploadModule } from 'devextreme-angular/ui/file-manager/n
@Component({
selector: 'dx-file-manager',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/file-uploader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-file-uploader',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/filter-builder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-filter-builder',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import { DxiFormTabbedItemComponent } from 'devextreme-angular/ui/form/nested';
@Component({
selector: 'dx-form',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/funnel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import { DxoFunnelTooltipBorderModule } from 'devextreme-angular/ui/funnel/neste
selector: 'dx-funnel',
template: '',
styles: [ ' :host { display: block; }'],
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/gallery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { DxiGalleryItemComponent } from 'devextreme-angular/ui/gallery/nested';
@Component({
selector: 'dx-gallery',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/gantt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import { DxiGanttStripLineComponent } from 'devextreme-angular/ui/gantt/nested';
@Component({
selector: 'dx-gantt',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/html-editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-html-editor',
template: '<ng-content></ng-content>',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/linear-gauge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import { DxoLinearGaugeWidthModule } from 'devextreme-angular/ui/linear-gauge/ne
selector: 'dx-linear-gauge',
template: '',
styles: [ ' :host { display: block; }'],
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import { DxiListMenuItemComponent } from 'devextreme-angular/ui/list/nested';
@Component({
selector: 'dx-list',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/load-indicator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
@Component({
selector: 'dx-load-indicator',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/load-panel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import { DxoLoadPanelToModule } from 'devextreme-angular/ui/load-panel/nested';
@Component({
selector: 'dx-load-panel',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-lookup',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import { DxiMapRouteComponent } from 'devextreme-angular/ui/map/nested';
@Component({
selector: 'dx-map',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import { DxiMenuItemComponent } from 'devextreme-angular/ui/menu/nested';
@Component({
selector: 'dx-menu',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/multi-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { DxiMultiViewItemComponent } from 'devextreme-angular/ui/multi-view/nest
@Component({
selector: 'dx-multi-view',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/number-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
@Component({
selector: 'dx-number-box',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/pagination/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
@Component({
selector: 'dx-pagination',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/pie-chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ import { DxiPieChartSeriesComponent } from 'devextreme-angular/ui/pie-chart/nest
selector: 'dx-pie-chart',
template: '',
styles: [ ' :host { display: block; }'],
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { DxoPivotGridFieldChooserTextsModule } from 'devextreme-angular/ui/pivot
@Component({
selector: 'dx-pivot-grid-field-chooser',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/ui/pivot-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { DxoPivotGridTextsModule } from 'devextreme-angular/ui/pivot-grid/nested
@Component({
selector: 'dx-pivot-grid',
template: '',
host: { ngSkipHydration: 'true' },
providers: [
DxTemplateHost,
WatcherHelper,
Expand Down
Loading
Loading