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

Move the reference value back to the header

Oliver Güntherb5888161eeb3
diff --git a/frontend/src/stimulus/controllers/poll-for-changes.controller.ts b/frontend/src/stimulus/controllers/poll-for-changes.controller.ts
index 811dc91926f..ba6712479da 100644
--- a/frontend/src/stimulus/controllers/poll-for-changes.controller.ts
+++ b/frontend/src/stimulus/controllers/poll-for-changes.controller.ts
@@ -39,9 +39,11 @@ export default class PollForChangesController extends ApplicationController {
autoscrollEnabled: Boolean,
};
- static targets = ['reloadButton'];
+ static targets = ['reloadButton', 'reference'];
declare reloadButtonTarget:HTMLLinkElement;
+ declare referenceTarget:HTMLElement;
+ declare readonly hasReferenceTarget:boolean;
declare referenceValue:string;
declare urlValue:string;
@@ -69,12 +71,20 @@ export default class PollForChangesController extends ApplicationController {
clearInterval(this.interval);
}
+ buildReference():string {
+ if (this.hasReferenceTarget) {
+ return this.referenceTarget.dataset.referenceValue as string;
+ }
+
+ return this.referenceValue;
+ }
+
reloadButtonTargetConnected() {
this.reloadButtonTarget.addEventListener('click', this.rememberCurrentScrollPosition.bind(this));
}
triggerTurboStream() {
- void fetch(`${this.urlValue}?reference=${this.referenceValue}`, {
+ void fetch(`${this.urlValue}?reference=${this.buildReference()}`, {
headers: {
Accept: 'text/vnd.turbo-stream.html',
},
diff --git a/modules/meeting/app/components/meetings/header_component.html.erb b/modules/meeting/app/components/meetings/header_component.html.erb
index c27700bbe91..1d327152d6a 100644
--- a/modules/meeting/app/components/meetings/header_component.html.erb
+++ b/modules/meeting/app/components/meetings/header_component.html.erb
@@ -1,6 +1,5 @@
<%=
helpers.content_controller "poll-for-changes",
- poll_for_changes_reference_value: @meeting.changed_hash,
poll_for_changes_url_value: check_for_updates_meeting_path(@meeting),
poll_for_changes_interval_value: check_for_updates_interval,
poll_for_changes_autoscroll_enabled_value: true
@@ -8,7 +7,11 @@
component_wrapper do
render(Primer::OpenProject::PageHeader.new(
test_selector: "meeting-page-header",
- state: @state
+ state: @state,
+ data: {
+ poll_for_changes_target: "reference",
+ reference_value: @meeting.changed_hash
+ }
)) do |header|
header.with_title do |title|
title.with_editable_form(model: @meeting,