Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Revert "Remove input property binding from the datepicker ids."

Alexander Brandon Coles69d1f5dc1c2c
diff --git a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts
index 9c5d403c4c2..4ccfd161c3f 100644
--- a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts
+++ b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts
@@ -103,25 +103,7 @@ export class OpBasicRangeDatePickerComponent implements OnInit, ControlValueAcce
return this._value;
}
- // Having an `@Input() id;` property breaks the turbo morphing with idiomorph.
- // The reason is, the `id` set by angular will override the `id` set as html attribute on
- // the component.
- // This is problematic, because new elements from the response template
- // will not have angular initialized on them, and calling `element.id` will return the html
- // id attribute, while calling `element.id` on existing elements will return the angular
- // defined `id` property.
- // It also means, when idiomorph compares the new elements with the old ones,
- // the same element will have a different id set, and it will not be matched. The old element
- // will have the angular `@Input id` property, while new one will have the html id attribute.
- //
- // The solution is to rename the `id` to `inputId`. The component would still get an id
- // attribute assigned if provided when declaring the component, but angular will not
- // programatically overwrite the `id` getter.
- //
- // This comment can be removed once the https://github.com/bigskysoftware/idiomorph/pull/131
- // is accepted.
-
- id = `flatpickr-input-${+(new Date())}`;
+ @Input() id = `flatpickr-input-${+(new Date())}`;
@Input() name = '';
diff --git a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts
index 99984ef3426..216a47eea12 100644
--- a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts
+++ b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts
@@ -81,22 +81,7 @@ export class OpBasicSingleDatePickerComponent implements ControlValueAccessor, O
return this._value;
}
- // Having an `@Input() id;` property breaks the turbo morphing with idiomorph.
- // The reason is, the `id` set by angular will override the `id` set as html attribute on
- // the component.
- // This is problematic, because new elements from the response template
- // will not have angular initialized on them, and calling `element.id` will return the html
- // id attribute, while calling `element.id` on existing elements will return the angular
- // defined `id` property.
- // It also means, when idiomorph compares the new elements with the old ones,
- // the same element will have a different id set, and it will not be matched. The old element
- // will have the angular `@Input id` property, while new one will have the html id attribute.
- //
- // The solution is to not have the id as an input property, this way the angular id won't
- // interfere when calling the html id attribute of the component. The component would still
- // get an id attribute assigned if provided when declaring the component, but it will not
- // programatically overwrite the id accessor from angular.
- id = `flatpickr-input-${+(new Date())}`;
+ @Input() id = `flatpickr-input-${+(new Date())}`;
@Input() name = '';