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

Feat: chokidar options #6

Open
wants to merge 3 commits into
base: v4
Choose a base branch
from
Open

Feat: chokidar options #6

wants to merge 3 commits into from

Conversation

jipodine
Copy link
Contributor

Expose Chokidar options.

@b-ma
Copy link
Collaborator

b-ma commented Feb 21, 2024

Let's not expose chokidar so we can change the underlying lib

@b-ma b-ma closed this Feb 21, 2024
@jipodine
Copy link
Contributor Author

Decoupling is fine.

However, we should find a way to get the initial events (creation of files and directories). The executeListener option of the onUpdate method only provides the initial tree, similar to calling getTree. (events is null.)

In Chokidar, the ignoreInitial option of the watcher provides both the initial tree and the creation events. It will affect any onUpdate registrations.

@jipodine jipodine reopened this Feb 22, 2024
@b-ma
Copy link
Collaborator

b-ma commented Feb 23, 2024

Let's create a list of add events with current tree if executeListener is set to true, something like:

onUpdate(callback, executeListener = false) {
      if (executeListener === true) {
         const values = this._treeState.getValues();
         values.events = createListOfAddEvent(values.tree);
         callback(values, {});
      }
      return this._treeState.onUpdate(callback, false);
}

Both on server and client side

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.

2 participants