-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
fix(views): engine events; update DendronTreeView reliably #2269
Conversation
9202849
to
e72289d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts:
- I like the event emitter interface and eventing
- I don't like that this is in
plugin-core
vsengine-server
since this is something that other clients should also be able to re-use - I don't like that this duplicates the function of
HistoryInstance
which is inengine-server
Some proposals:
- if we want to start off with a clean slate for eventing, we should at least move this out of
plugin-core
. Attach these functions toDendronEngineClient
inengine-server
instead - event emitters should emit
NoteChangeEntry[]
as their payload, not just theNote
- can we have a rough migration plan on how we would merge
HistoryInstance
with the new eventing interface? (eg. interface required to fully replicate functionality )
Other comments:
- we currently have a way of "pausing" the watcher for bulk operations (eg. refactor) to avoid updating the tree view until everything is done. do we have that capability in this new interface?
- similarly, how do we stop listening to events?
Proposals
Other Comments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just one nitpick for docs.
Will this interface be replacing the HistoryInstance
then? Or will we be keeping both since HistoryInstance
has some features like lookback that this doesn't?
They will eventually be converged - |
@kevinslin - as I was working on some tests for the events, I noticed that some scenarios don't seem to have the correct payloads for what's changed in the engine, as reported by
We should add docstrings to these methods detailing their exact intended behavior, especially if they are widely used API's. |
56c413c
to
9f73754
Compare
Yep, agreed. This has been an internal API and can definitely be improved.
The difference is if they write notes to disk.
This parameter is for the case when
Yep. we notify that the old note was deleted and new note is created. this is used by |
looks like there's a build error |
should be patched now |
packages/engine-test-utils/src/__tests__/engine-server/EngineEvents.spec.ts
Show resolved
Hide resolved
packages/engine-test-utils/src/__tests__/engine-server/EngineEvents.spec.ts
Outdated
Show resolved
Hide resolved
packages/engine-test-utils/src/__tests__/engine-server/EngineEvents.spec.ts
Outdated
Show resolved
Hide resolved
packages/engine-test-utils/src/__tests__/engine-server/EngineEvents.spec.ts
Show resolved
Hide resolved
packages/engine-test-utils/src/__tests__/engine-server/EngineEvents.spec.ts
Outdated
Show resolved
Hide resolved
56a395c
to
aad576e
Compare
fix(views): engine events; update DendronTreeView reliably
This change introduces a new model for updating plugin-core UI components based on an eventing system using
vscode.Event
-likeevent
andEventEmitter
. The change also refactors the native DendronTreeView to utilize the new events. This change provides a UI model that helps us improve UI reliability, performance, and also allows us to further unwind circular dependencies.Engine Events
EngineEvents
, which exposes a new event that fires when notes have been created, updated, and deleted.engineClient
andstorev2
to have the correct data payloads forNoteChangeEvent
s.Tree View
DendronTreeView
->NativeTreeView
string
toNoteProps
refresh()
public methods, but instead has an instance ofEngineEvents
injected into its constructor. All UI updates are handle internally.Pull Request Checklist
If this is your first time submitting a pull request to Dendron, copy and paste the full Dendron Review Checklist into this request and check off each item as necessary.
This template contains the short checklist which is used by the Dendron core team.
Testing
Docs
Analytics