adobe-photoshop / spaces-design

Adobe Photoshop Design Space
http://adobe-photoshop.github.io/
Other
852 stars 74 forks source link

Opening large documents in one open command will cause an error #3679

Closed ktaki closed 8 years ago

ktaki commented 8 years ago

Uncaught TypeError: Cannot read property 'id' of null

Method:

  1. Reset DS
  2. Locate Vermilion doc and create a copy of it. (i.e., two Vermilions)
  3. Cmd/Ctrl-o.
  4. Select the original Vermilion doc and its copy at the same time.
  5. Click Open.

screen shot 2016-02-05 at 1 34 17 pm

iwehrman commented 8 years ago

I can't reproduce, but looking at allocateDocument I'm not surprised that something could go awry here: we call _getSelectedDocumentID to allocate the "current" document, regardless of whether that relates to the document ID passed in (which is a little weird?), but conceivably a new document could become active after that as a result of multiple documents having been opened at once. CC @mcilroyc

Ultimately this seems like a battle with Photoshop that we can't win unless its API changes to accommodate our use case. If multiple documents are going to be opened at once, we'll need much more structured information than just a series events indicating that a file was opened.

iwehrman commented 8 years ago

With that said, I don't know exactly what is causing that particular error, and that would be good to track down in case either a) my guess above about what's wrong is incorrect, or b) it's correct, but we can recover more gracefully. CC @shaoshing also since he may be considering our document initialization routines as part of his performance optimization work.

mcilroyc commented 8 years ago

My initial hunch is that a reasonable fix may just be to add some defensive code in the menu update routine. I'm still trying to repro. Perhaps I need to try on a slower machine...

ktaki commented 8 years ago

If two Vermillion documents do not produce the error, try with three or four duplicates.

mcilroyc commented 8 years ago

FYI, can repro on Windows VM

iwehrman commented 8 years ago

FBNC to @ktaki.

ktaki commented 8 years ago

Verified the fix.