Coreh/nide — pull request #63 by notatestuser (2012-08-27 02:07:21+00:00)
Title: Fixed directory structure being sent before being fully built on opening a project

Kudos for the great work on this project, I'm really impressed. However, there was one little issue that cropped up after I decided to add another structural level to my project, which looked something like so:

./package.json
./responses/file1.json
./responses/file2.json

Simple! The issue was that upon loading the project (by running the 'nide' command in the root directory), the 'responses' directory had been showing as containing no files (i.e. empty). After a bit of debugging it seemed that adding some logging statements to the code responsible for injecting things into the listCache slowed the execution down enough that the files were visible more often than before when starting nide repeatedly. Therefore, and after some further investigation, I figured the object was being sent out too quickly -- before it had actually been constructed.

After this change we're now ensuring that the number of processed files equals the number of 'encountered' files before we proceed to dispatch the listCache off to the client. This is serving as an effective fix to the problem I've been able to replicate locally.