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

[Bug]: Show in Tree does nothing #778

Closed
Fabian-Hofer-Mastertent opened this issue Dec 3, 2024 · 3 comments
Closed

[Bug]: Show in Tree does nothing #778

Fabian-Hofer-Mastertent opened this issue Dec 3, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@Fabian-Hofer-Mastertent
Copy link

Pimcore version

11.4.3

Steps to reproduce

  1. Open any Data Object in demo.pimcore.fun/admin
  2. click on "Show in Tree"

Actual Behavior

Clicking on "Show in Tree" does nothing since the last update

Expected Behavior

Normally "Show in Tree" would open the Data Object in the Object Tree.

@arrabiata-asanz
Copy link

arrabiata-asanz commented Dec 3, 2024

I think this issue can be opened on the admin-ui-classic-bundle repository.

vendor/pimcore/admin-ui-classic-bundle/public/js/pimcore/treenodelocator.js::processTree
rootNodeId is of type int, globalState.pathIds is an array of strings and the Array.prototype.indexOf() function compares the values strictly, because of that the execution is aborted
if (globalState.pathIds.indexOf(rootNodeId) == -1) {

Possible solution for the bug:

Subject: [PATCH] patch for show in tree function
---
Index: public/js/pimcore/treenodelocator.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/public/js/pimcore/treenodelocator.js b/public/js/pimcore/treenodelocator.js
--- a/public/js/pimcore/treenodelocator.js	(revision 89c871372cda984f86318eaefe2e2a0ea5ff4f5e)
+++ b/public/js/pimcore/treenodelocator.js	(revision b480d4c0298be868f41ddf08e5a087e311d48b9c)
@@ -154,7 +154,7 @@
             var locateConfig = globalState.locateConfigs[globalState.currentTreeIndex];
             var tree = locateConfig.tree;
             var rootNode = tree.tree.getRootNode();
-            var rootNodeId = rootNode.getId();
+            var rootNodeId = String(rootNode.getId());
 
             // Tree root may be shifted to a subnode and the item to be shown
             // is out of tree scope - don't continue if this is the case:

@kingjia90 kingjia90 transferred this issue from pimcore/pimcore Dec 3, 2024
@kingjia90 kingjia90 modified the milestones: 1.7.1, 1.6.4 Dec 3, 2024
@kingjia90
Copy link
Contributor

kingjia90 commented Dec 3, 2024

Thank you for reporting and also @arrabiata-asanz for suggesting a solution.

I've opened a PR #779 and opted to convert the array values to Number, because id are mostly int now (using/passing as string is deprecated) and because here is suggested so

@kingjia90 kingjia90 linked a pull request Dec 3, 2024 that will close this issue
@arrabiata-asanz
Copy link

@kingjia90 thank you for the PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants