Skip to content

Commit 293a4d4

Browse files
authored
Fix #1121 Lightning Navigation from Analytics / Tableau issue (#1123)
# Describe your changes Fix Lightning Navigation from Analytics / Tableau ## Issue ticket number and link Fix #1121 ## Checklist before requesting a review - [ ] I have **read and understand** the [Contributions section](https://github.com/tprouvot/Salesforce-Inspector-reloaded#contributions) - [ ] My PR relates to an existing issue or feature request and **I discussed it with maintainer** - [ ] I used SLDS style and limit the usage of custom CSS - [ ] I have performed a self-review of my code - [ ] I ran the [unit tests](https://github.com/tprouvot/Salesforce-Inspector-reloaded#unit-tests) and my PR does not break any tests - [ ] I documented the changes I've made on the [CHANGES.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/CHANGES.md) and followed actual conventions - [ ] I added a new section on [how-to.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/docs/how-to.md) (optional)
1 parent c027846 commit 293a4d4

2 files changed

Lines changed: 31 additions & 26 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Version 2.0
44

5+
- Fix Lightning Navigation from Analytics / Tableau [issue #1121](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/1121)
56
- `Popup` review cache management in "Preload SObjects before popup opens". If enabled, refresh of SObject definition is done every "SObjects List Cache" hours, else done in background when the popup is expanded
67
- `Rest Explorer` fix a performance issue (edit entrypoint rerender completely the output even if no changes) (contribution by [Nicolas Greard](https://github.com/ngreardSF))
78
- `Popup` fix recent items scroll not working anymore in v2 (contribution by [Nicolas Greard](https://github.com/ngreardSF))

addon/inject.js

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
11
// This file was created to avoid requesting the "scripting" permission, which can lead to the extension being blacklisted by some companies.
22

33
document.addEventListener("lightningNavigate", (event) => {
4-
handleLightningNavigation(event.detail);
4+
handleLightningNavigation(event.detail);
55
});
66

77
function handleLightningNavigation(details) {
8-
try {
9-
switch (details.navigationType) {
10-
case "recordId":
11-
navigateToSObject(details.recordId);
12-
break;
13-
case "url":
14-
navigateToURL(details.url);
15-
break;
16-
default:
17-
throw new Error("Invalid navigation type");
18-
}
19-
} catch (error) {
20-
console.error("Lightning navigation failed, falling back to default navigation:", error.message);
21-
window.open(details.fallbackURL, "_top");
8+
try {
9+
if (details.fallbackURL && /\/analytics\b|\/tableau\b|AnalyticsStudio/i.test(window.location.pathname || "")) {
10+
window.open(details.fallbackURL, "_top");
11+
return;
2212
}
23-
24-
function navigateToSObject(recordId) {
25-
const e = $A.get("e.force:navigateToSObject");
26-
e.setParams({ "recordId": recordId });
27-
e.fire();
13+
switch (details.navigationType) {
14+
case "recordId":
15+
navigateToSObject(details.recordId);
16+
break;
17+
case "url":
18+
navigateToURL(details.url);
19+
break;
20+
default:
21+
throw new Error("Invalid navigation type");
2822
}
23+
} catch (error) {
24+
console.error("Lightning navigation failed, falling back to default navigation:", error.message);
25+
window.open(details.fallbackURL, "_top");
26+
}
2927

30-
function navigateToURL(url) {
31-
const e = $A.get("e.force:navigateToURL");
32-
e.setParams({ url: url });
33-
e.fire();
34-
}
35-
}
28+
function navigateToSObject(recordId) {
29+
const e = $A.get("e.force:navigateToSObject");
30+
e.setParams({recordId});
31+
e.fire();
32+
}
33+
34+
function navigateToURL(url) {
35+
const e = $A.get("e.force:navigateToURL");
36+
e.setParams({url});
37+
e.fire();
38+
}
39+
}

0 commit comments

Comments
 (0)