Skip to content

Commit 69828ec

Browse files
authored
Merge pull request #446 from SalesforceLabs/445-recompilation-of-apexclass-button-may-not-work
fix: symboltable is null when it should not Recompilation of ApexClas…
2 parents 9694691 + d1c853f commit 69828ec

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

force-app/main/default/lwc/orgcheckApp/api/core/orgcheck-api-sfconnectionmanager.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class DailyApiRequestLimitInformation {
2020
}
2121

2222
const MAX_COMPOSITE_REQUEST_SIZE = 25;
23+
const MAX_NOQUERYMORE_BATCH_SIZE = 200;
2324
const DAILY_API_REQUEST_WARNING_THRESHOLD = 0.70; // =70%
2425
const DAILY_API_REQUEST_FATAL_THRESHOLD = 0.90; // =90%
2526

@@ -277,7 +278,7 @@ export class OrgCheckSalesforceManager {
277278
const conn = query.tooling === true ? this.#connection.tooling : this.#connection;
278279
const sequential_query = (callback) => {
279280
if (query.queryMore === false) {
280-
conn.query(`${query.string} LIMIT 2000 OFFSET ${nbQueryMore * 2000}`, { autoFetch: false }, callback);
281+
conn.query(`${query.string} LIMIT ${MAX_NOQUERYMORE_BATCH_SIZE} OFFSET ${nbQueryMore * MAX_NOQUERYMORE_BATCH_SIZE}`, { autoFetch: false }, callback);
281282
} else {
282283
conn.query(query.string, { autoFetch: true }, callback);
283284
}
@@ -300,7 +301,7 @@ export class OrgCheckSalesforceManager {
300301
records.push(... d.records);
301302
if (query.queryMore === false) {
302303
// Here we can't call queryMore (the sobject in the FROM statment does not support it, like EntityDefinition)
303-
if (d.records.length < 2000) {
304+
if (d.records.length < MAX_NOQUERYMORE_BATCH_SIZE) {
304305
nbQueriesDone++;
305306
nbQueriesPending--;
306307
resolve({ records: records });

force-app/main/default/lwc/orgcheckApp/api/dataset/orgcheck-api-dataset-apexclasses.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export class OrgCheckDatasetApexClasses extends OrgCheckDataset {
2020
'CreatedDate, LastModifiedDate '+
2121
'FROM ApexClass '+
2222
'WHERE ManageableState IN (\'installedEditable\', \'unmanaged\') ',
23-
tooling: true
23+
tooling: true,
24+
queryMore: false
2425
}, {
2526
string: 'SELECT ApexClassOrTriggerId, ApexTestClassId '+
2627
'FROM ApexCodeCoverage',

force-app/main/default/lwc/orgcheckApp/orgcheckApp.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,16 @@ export default class OrgCheckApp extends LightningElement {
205205
if (cr.body.success === true) {
206206
this.#spinner.sectionEnded(`request-to-recompile-${c.id}`, `Recompilation requested for class: ${c.name}`);
207207
} else {
208-
this.#spinner.sectionFailed(`request-to-recompile-${c.id}`, `Errors for class ${c.name}: ${cr.errors.map(e => JSON.stringify(e)).join(', ')}`);
208+
let reasons = [];
209+
if (cr.body && Array.isArray(cr.body)) {
210+
reasons = cr.body;
211+
} else if (cr.errors && Array.isArray(cr.errors)) {
212+
reasons = cr.errors;
213+
}
214+
this.#spinner.sectionFailed(`request-to-recompile-${c.id}`, `Errors for class ${c.name}: ${reasons.map(e => JSON.stringify(e)).join(', ')}`);
209215
}
210216
}));
211-
this.#spinner.sectionEnded('request-to-recompile', 'In case you need to recompile ALL the classes, go to "Setup > Custom Code > Apex Classes" and click on the link "Compile all classes".');
217+
this.#spinner.sectionEnded('request-to-recompile', 'Please hit the Refresh button (in Org Check) to get the latest data from your Org. By the way, in the future, if you need to recompile ALL the classes, go to "Setup > Custom Code > Apex Classes" and click on the link "Compile all classes".');
212218
this.#spinner.canBeClosed();
213219
}
214220

0 commit comments

Comments
 (0)