Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,9 @@ const createRepository = (args: ICreateBackendRepositoryArgs): IBackendRepositor

const exportToExcel = (payload: IGetListDataPayload): Promise<void> => {
let excelColumns = payload.columns
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Use const instead of let for immutable variable.

The excelColumns variable is never reassigned, so it should be declared with const to prevent accidental mutations and improve code clarity.

Apply this diff:

-    let excelColumns = payload.columns
+    const excelColumns = payload.columns
         .filter(c => c.isVisible)
         .map<IExcelColumn>(c => ({ propertyName: c.propertyName, label: c.caption }));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let excelColumns = payload.columns
const excelColumns = payload.columns
.filter(c => c.isVisible)
.map<IExcelColumn>(c => ({ propertyName: c.propertyName, label: c.caption }));
🤖 Prompt for AI Agents
In shesha-reactjs/src/providers/dataTable/repository/backendRepository.tsx
around line 258, the variable declaration uses "let excelColumns =
payload.columns" but excelColumns is never reassigned; change the declaration to
"const excelColumns = payload.columns" to make it immutable and prevent
accidental reassignments, leaving the rest of the code unchanged.

.filter(c => c.isVisible)
.map<IExcelColumn>(c => ({ propertyName: c.propertyName, label: c.caption }));

if (excelColumns.findIndex(c => c.propertyName === 'id') === -1) {
excelColumns = [{ propertyName: 'id', label: 'Id' }, ...excelColumns];
}

const getDataPayload = convertPayload(payload);

const excelPayload: IExportExcelPayload = {
Expand Down