Use native turbo reload mechanism instead of our own global_reload controller

This commit is contained in:
Jan Böhmer 2026-02-22 21:46:55 +01:00
parent b6d77af91b
commit e2b43ba01f
3 changed files with 6 additions and 31 deletions

View file

@ -1,27 +0,0 @@
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Controller } from '@hotwired/stimulus';
export default class extends Controller {
connect() {
//If we encounter an element with global reload controller, then reload the whole page
window.location.reload();
}
}

View file

@ -16,10 +16,7 @@
</turbo-stream>
{% endblock %}
{# Allow pages to request a fully reload of everything #}
{% if global_reload_needed is defined and global_reload_needed %}
<div {{ stimulus_controller('turbo/global_reload') }}></div>
{% endif %}
{# Insert info about when the sidebar trees were updated last time, so the sidebar_tree_controller can decide if it needs to reload the tree #}
<span id="sidebar-last-time-updated" style="display: none;" data-last-update="{{ sidebar_tree_updater.lastTreeUpdate.format("Y-m-d\\TH:i:sP") }}"></span>

View file

@ -26,6 +26,11 @@
<meta name="turbo-refresh-method" content="morph">
<meta name="turbo-refresh-scroll" content="preserve">
{# Allow pages to request a fully reload of everything #}
{% if global_reload_needed is defined and global_reload_needed %}
<meta name="turbo-visit-control" content="reload">
{% endif %}
<link rel="shortcut icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('icon/apple-touch-icon.png') }}">
<link rel="icon" type="image/png" href="{{ asset('icon/favicon-32x32.png') }}" sizes="32x32">