[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Fix 'current_object' remaining unset in JS due to value synchronization...

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69b4634d17577_3b18b9c4380@gitlab-sidekiq-low-urgency-cpu-bound-v2-c9b45bfd9-m6tnj.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
5cb4b7c5 by Merci Jacob at 2026-03-13T19:12:20+00:00
[FIX] Fix 'current_object' remaining unset in JS due to value synchronization occurring after JavaScript variables are set
---
* still set 'current_object' globally, but also update its value on sectionChange

* [FIX] Fix 'current_object' remaining unset in JS due to value synchronization occurring after JavaScript variables are set

See merge request tikiwiki/tiki!9623

- - - - -


1 changed file:

- lib/setup/javascript.php


Changes:

=====================================
lib/setup/javascript.php
=====================================
@@ -9,6 +9,7 @@ use Tiki\Lib\CookieConsent\CookieConsentLib;
 use Tiki\Lib\Theme\ThemeLib;
 use Tiki\Lib\TikiDate;
 use Tiki\TaskQueue\QueuedTaskBanner;
+use Tiki\Sections;
 
 if (basename($_SERVER['SCRIPT_NAME']) === basename(__FILE__)) {
     die('This script may only be included.');
@@ -270,6 +271,7 @@ if (empty($object)) {
     $object = ['type' => '', 'object' => ''];
 }
 $jqueryTiki['current_object'] = $object;
+
 $username_pattern = " / ^ ['\-_a-zA-Z0-9\.]*$/";
 if (is_string($prefs['username_pattern'])) {
     if (trim($prefs['username_pattern']) && trim($prefs['username_pattern']) !== '') {
@@ -454,6 +456,10 @@ EOT;
 
 $headerlib->add_js($js);
 
+Sections::onSectionChange(function ($section) use ($headerlib) {
+    $headerlib->add_js("jqueryTiki.current_object = " . json_encode(current_object()) . ";");
+});
+
 if ($prefs['feature_ajax'] != 'y') {
     $prefs['ajax_autosave'] = 'n';
 }



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5cb4b7c539eced6992093d1e0a225724a78adc1f

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5cb4b7c539eced6992093d1e0a225724a78adc1f
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.