Skip to content

fix: TypeError: Cannot read properties of null (reading 'classList')#196

Closed
akhilnarang wants to merge 1 commit intofrappe:masterfrom
akhilnarang:fix-typeerror
Closed

fix: TypeError: Cannot read properties of null (reading 'classList')#196
akhilnarang wants to merge 1 commit intofrappe:masterfrom
akhilnarang:fix-typeerror

Conversation

@akhilnarang
Copy link

Sentry PRESS-4KJ / Support 10958

Not sure if this is "correct"

Sentry PRESS-4KJ / Support 10958

TypeError: Cannot read properties of null (reading 'classList')
  at ? (../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:2940:37)
  at Array.forEach(<anonymous>)
  at Ye.clearSelection(../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:2940:14)
  at Ye._selectArea(../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:2877:14)
  at Ye.selectArea(../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:2865:18)
  at HTMLDivElement.t(../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:2723:18)
  at invokeFunc(../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:632:19)
  at trailingEdge(../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:681:14)
  at timerExpired(../../../../../apps/frappe/node_modules/frappe-datatable/dist/frappe-datatable.cjs.js:669:14)
  at r(../../../../../apps/frappe/node_modules/src/helpers.ts:98:1)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
(this._selectedCells || [])
.forEach($cell => $cell.classList.remove('dt-cell--highlight'));

.forEach($cell => {
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem correct. The real problem is this array containing null... why does that happen?

if that root cause is harmless then fix is fine.

@sokumon
Copy link
Member

sokumon commented Jun 5, 2025

The cause of this was when users sort the column and try selecting the cells (replicated it randomly one day)
it glitched and didn't work
Fixed it here #208. Closing this

@sokumon sokumon closed this Jun 5, 2025
@akhilnarang akhilnarang deleted the fix-typeerror branch October 7, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants