Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'classList' of null #19

Open
LuisFRosas opened this issue Jul 11, 2017 · 17 comments · May be fixed by #34
Open

Uncaught TypeError: Cannot read property 'classList' of null #19

LuisFRosas opened this issue Jul 11, 2017 · 17 comments · May be fixed by #34

Comments

@LuisFRosas
Copy link

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.18.0 x64
Electron: 1.3.15
OS: Unknown Windows version
Thrown From: open-files package 0.8.2

Stack Trace

Uncaught TypeError: Cannot read property 'classList' of null

At C:\Users\Luis\.atom\packages\open-files\lib\open-files-pane-view.js:454

TypeError: Cannot read property 'classList' of null
    at OpenFilesPaneView.updateModifiedState (/packages/open-files/lib/open-files-pane-view.js:454:20)
    at /packages/open-files/lib/open-files-pane-view.js:405:22
    at Function.module.exports.Emitter.simpleDispatch (~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/event-kit/lib/emitter.js:141:34)
    at TextBuffer.module.exports.TextBuffer.emitModifiedStatusChanged (~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/text-buffer/lib/text-buffer.js:1457:33)
    at ~/AppData/Local/atom/app-1.18.0/resources/app/node_modules/text-buffer/lib/text-buffer.js:1446:30

Commands

  3x -2:41.3.0 core:save (input.hidden-input)
  2x -0:48.4.0 editor:newline (input.hidden-input)
  2x -0:46 core:backspace (input.hidden-input)
     -0:43.6.0 editor:newline (input.hidden-input)
     -0:41.8.0 autocomplete-plus:confirm (input.hidden-input)
     -0:41.7.0 autocomplete-plus:activate (atom-text-editor.editor.is-focused)
  3x -0:39.5.0 core:backspace (input.hidden-input)
     -0:37.9.0 autocomplete-plus:confirm (input.hidden-input)
     -0:27.6.0 editor:newline (input.hidden-input)
  2x -0:25.8.0 core:backspace (input.hidden-input)
     -0:24.5.0 autocomplete-plus:confirm (input.hidden-input)
     -0:24.5.0 autocomplete-plus:activate (atom-text-editor.editor.is-focused)
     -0:22.3.0 autocomplete-plus:confirm (input.hidden-input)
     -0:05.9.0 core:move-right (input.hidden-input)
     -0:04.9.0 autocomplete-plus:confirm (input.hidden-input)
     -0:04.9.0 autocomplete-plus:activate (atom-text-editor.editor.is-focused)

Non-Core Packages

browser-refresh-on-save 0.0.6 
emmet 2.4.3 
file-icons 2.1.7 
monokai-seti 0.9.0 
open-files 0.8.2 
opened-files 0.3.6 
Remote-FTP 0.10.7 
seti-syntax 1.1.3 
seti-ui 1.8.0 
wordpress-autocomplete 1.1.4 
@oriolmirosa
Copy link
Owner

Thanks for reporting this, @LuisFRosas. I will need some more info in order to debug this:

  1. Can you tell me what files and panels you had open when this happened?
  2. What file were you modifying?
  3. Can you reproduce the bug?
  4. I see that you had the opened-files package installed as well. It is possible that that's where the problem comes from. Have you tried to run only the open-files package and disable opened-files? If so, does the problem persist?

Thanks!

@skjnldsv
Copy link

skjnldsv commented Sep 28, 2017

I have this issue as well :(
It happens when I try to close the settings when it's opened on the first pane.

kazam

@sygint
Copy link

sygint commented Oct 13, 2017

I get this all the time just switching tabs

@joedf
Copy link

joedf commented Nov 8, 2017

For me, it seems it is more particular switching to package changelog tabs

@asdf23
Copy link

asdf23 commented Feb 2, 2018

What was the tool to create the gif?

I seem to trigger this bug when I switch to a tab that does not have selected text. (Not sure this is related, but also both tabs are unsaved files).

This fails everytime --->
So workflow would be open atom, Ctrl + N, Ctrl + N, Ctrl + PageUp

@greedylan
Copy link

Do we have any update on this issue?

@asdf23
Copy link

asdf23 commented Apr 5, 2018

I try/caught this on my box and it's no longer crashing

@skjnldsv
Copy link

skjnldsv commented Apr 5, 2018

What was the tool to create the gif?

kazam + gifify

@oriolmirosa
Copy link
Owner

Sorry all for the radio silence. I have a new full-time job with a startup and I'm swamped, plus I'm a new dad, so things are crazy on my end. Moreover, I don't get the crash so it's hard to test and fix from here. I'll try to work on this during the weekend and will report back then. Sorry again.

@misterbridge
Copy link

Any news ?

@asdf23
Copy link

asdf23 commented Feb 25, 2019

open-files-pane-view.js

~line 454
Change

    if (entry) {
      entry.element.classList.toggle('modified', modified);
    }

to

    if (entry && entry.element) {
      entry.element.classList.toggle('modified', modified);
    }

and again ~ 470

				this.activeEntry = entry.element;
				entry.element.classList.add('selected');
			}```

@Kanaduchi
Copy link

@oriolmirosa Any updates on this issue? I get this error every day. It is very annoying

@newlukai
Copy link

I can reproduce this creating two files without saving them. Switching between both unnamed files raises this error.

@pauljherring
Copy link

Error:

Uncaught TypeError: Cannot read property 'classList' of null

/home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js:472
Hide Stack Trace
TypeError: Cannot read property 'classList' of null
    at OpenFilesPaneView.setActiveEntry (/home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js:472:19)
    at /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js:413:19
    at Function.simpleDispatch (/usr/share/atom/resources/app/static/<embedded>:11:1212922)
    at Emitter.emit (/usr/share/atom/resources/app/static/<embedded>:11:1214363)
    at Pane.setActiveItem (/usr/share/atom/resources/app/static/<embedded>:11:455685)
    at Pane.activateItem (/usr/share/atom/resources/app/static/<embedded>:11:457933)
    at TabBarView.onClick (/usr/share/atom/resources/app/static/<embedded>:11:1164009)
The error was thrown from the open-files package. This issue has already been reported.

What I did:

$ diff /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js{.old,} -u
--- /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js.old    2020-01-22 20:05:46.838623575 +0000
+++ /home/pherring/.atom/packages/open-files/lib/open-files-pane-view.js        2020-01-22 20:08:42.760613046 +0000
@@ -450,7 +450,7 @@

        updateModifiedState(item, modified) {
                let entry = this.entryForItem(item);
-    if (entry) {
+    if (entry && entry.element) {
       entry.element.classList.toggle('modified', modified);
     }
        }
@@ -467,7 +467,7 @@
                if (item) {
                        let entry = this.entryForItem(item);
                        this.activeEntry ? this.activeEntry.classList.remove('selected') : undefined;
-                       if (entry) {
+                       if (entry && entry.element) {
         this.activeEntry = entry.element;
                                entry.element.classList.add('selected');
                        }

While I can't confirm it's fixed the problem (it should) I've not had the error for a while...

Pysis868 added a commit to Pysis868/open-files that referenced this issue Mar 14, 2023
From oriolmirosa#19 asdf23 and pauljherring.
@Pysis868 Pysis868 linked a pull request Mar 14, 2023 that will close this issue
@Pysis868
Copy link

Made that PR.

Think this should work like the code posted here.

It happened to me I think when I split right to view the same file twice, maybe again and moved it back into the same left pane so I was viewing it 3 times in total.

I also saw some other fixes in the network/insights area for this project. I think it mentioned title code, and possibly more.

If this project is not being actively maintained, any recommendations for a fork?

@pauljherring
Copy link

If this project is not being actively maintained, any recommendations for a fork?

https://github.blog/2022-06-08-sunsetting-atom/

When we introduced Atom in 2011, we set out to give developers a text editor that was deeply customizable but also easy to use—one that made it possible for more people to build software. While that goal of growing the software creator community remains, we’ve decided to retire Atom in order to further our commitment to bringing fast and reliable software development to the cloud via Microsoft Visual Studio Code and GitHub Codespaces.

@Pysis868
Copy link

Pysis868 commented Mar 21, 2023

This package is still relevant with the new project and forked text editor/IDE Pulsar here: https://pulsar-edit.dev/about.html

It is even how I am using the package now.

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 a pull request may close this issue.