Skip to content

Commit

Permalink
Show info about potential issue if loading time more than 15 sec #454
Browse files Browse the repository at this point in the history
  • Loading branch information
VinceFINET committed Nov 19, 2024
1 parent 7164dfc commit 5359428
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 33 deletions.
6 changes: 2 additions & 4 deletions force-app/main/default/lwc/orgcheckApp/orgcheckApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ <h1><span class="slds-page-header__title slds-truncate">Welcome in Org Check ({o
<ul class="slds-list_dotted">
<li><b>Issues or new ideas?</b> Track them at <a href="https://sfdc.co/OrgCheck-Backlog"
target="_blank" rel="external noopener noreferrer">sfdc.co/OrgCheck-Backlog</a></li>
<li><b>Want to chat with other users?</b> Join us on Slack at <a href="https://sfdc.co/OrgCheck-Community"
<li><b>Want to chat with other users?</b> Join us on the Trailblazer Community at <a href="https://sfdc.co/OrgCheck-Community"
target="_blank" rel="external noopener noreferrer">sfdc.co/OrgCheck-Community</a></li>
<li><b>Social Media</b> Like and share posts on <a href="https://www.linkedin.com/company/OrgChecksfdc"
target="_blank" rel="external noopener noreferrer">LinkedIn</a> and on
<a href="https://twitter.com/OrgCheckSFDF" target="_blank" rel="external noopener noreferrer">
Twitter</a>!</li>
target="_blank" rel="external noopener noreferrer">LinkedIn</a>!</li>
</ul>
<br />
<b>Org Check is free to use, but is not an official Salesforce product. </b> Org Check has not been officially tested or documented.
Expand Down
83 changes: 54 additions & 29 deletions force-app/main/default/pages/OrgCheck_App_VFP.page
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
}
#loading-text {
}
#additional-info-issue-454 {
display: none;
color: rgb(170, 54, 54);
width: 25em;
}
.slds-dropdown-trigger_click .slds-dropdown {
min-width: fit-content;
}
Expand All @@ -32,38 +37,58 @@
</object>
</div>
<div id="loading-text">
Please wait while <b>Org Check</b> is loading...
Please wait while <b>Org Check</b> is loading...<br />
<br />
<span id="additional-info-issue-454">
Hello! <br />
<br />
You see this message because <b>two settings</b> (under the section <code>Session</code>)
are <b>both enabled at the same time</b> in your org, and these two together are preventing Org Check to
load successfuly.<br />
<br />
The settings are :<br />
1. Option <b><code>Enable Content Delivery Network (CDN) for Lightning Component framework</code></b><br />
2. Option <b><code>Cross-Origin Embedder Policy (COEP)</code></b><br />
<br />
<b><u>Solution:</u> This issue is corrected if you disable either one of the two options previously mentioned in the <a href="/lightning/setup/SecuritySession/home" target="_blank">setup menu</a>.</b>
</span>
</div>
</div>
</div>
<script>
/* Reset the cache of previous versions */
try {
Object.keys(localStorage)
.filter(e => e.startsWith('OrgCheck.'))
.forEach(e => localStorage.removeItem(e));
} catch (e) {
console.error('Error while resetting the cache of previous Org Check versions (prior to Lithium).')
}
/* Determine the namespace where the app is running (if local/standalone the package is 'c') */
const firstSubDomain = document.location.host.split('.')[0];
const subDomainParts = firstSubDomain.split('--');
const namespace = subDomainParts.pop(); // last part is the package name
/* Insert LWC app */
const app = `${namespace}:OrgCheck_App_Aura`;
const component = `${namespace}:orgcheckApp`;
$Lightning.use(app, () => {
$Lightning.createComponent(
component,
{
accessToken: '{! JSENCODE($Api.Session_Id) }',
userId: '{! JSENCODE($User.Id) }'
},
'app',
() => {
document.getElementById('loading').style.display = 'none';
}
);
});
setTimeout(() => {
document.getElementById('additional-info-issue-454').style.display = 'block';
}, 15000);

/* Reset the cache of previous versions */
try {
Object.keys(localStorage)
.filter(e => e.startsWith('OrgCheck.'))
.forEach(e => localStorage.removeItem(e));
} catch (e) {
console.error('For your information, I had an error while resetting the cache of previous Org Check versions (prior to Lithium).')
}

/* Determine the namespace where the app is running (if local/standalone the package is 'c') */
const firstSubDomain = document.location.host.split('.')[0];
const subDomainParts = firstSubDomain.split('--');
const namespace = subDomainParts.pop(); // last part is the package name

/* Insert LWC app */
const app = `${namespace}:OrgCheck_App_Aura`;
const component = `${namespace}:orgcheckApp`;
$Lightning.use(app, () => {
$Lightning.createComponent(
component,
{
accessToken: '{! JSENCODE($Api.Session_Id) }',
userId: '{! JSENCODE($User.Id) }'
},
'app',
() => {
document.getElementById('loading').style.display = 'none';
}
);
});
</script>
</apex:page>

0 comments on commit 5359428

Please sign in to comment.