-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
add many search feature #653
Conversation
- fix `SearchBar` focus race condition - fix wont search when press enter after mode switch - fix undisposed handler errors - merge search `SelectorType`s in `ContextNodeManager`
- add `DataNodeNode` - use `DataNodeNode` on `DataFlowView` - add `DataNode.applicationId` - `traceSelection.isSelected` supports nodeId
} | ||
|
||
handleClick = () => { | ||
const { applicationId, contextId } = this.context; |
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.
@MiccWan add dp
getter to ContextNode
instead
import allApplications from '@dbux/data/src/applications/allApplications'; | ||
import BaseTreeViewNode from './BaseTreeViewNode'; | ||
|
||
export default class TraceNode extends BaseTreeViewNode { | ||
get clickUserActionType() { |
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.
@MiccWan since this is part of Pathways
: did you make sure whether pathways works as expected when making this change?
We generally want to avoid touching features that we are not currently working on them. If absolutely necessary, make the change, but then also make sure to test the corresponding changes.
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.
Added getter of clickUserActionType
which returns false to BaseTreeViewNode
, so by default no UserEvent
will be send on click.
@@ -33,18 +36,34 @@ export default class GlobalAnalysisViewController { | |||
this.refresh(); | |||
} | |||
|
|||
handleSearch = async () => { | |||
await this.refresh(); | |||
this.focusOnSearchResult(); |
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.
@MiccWan no await
for this?
Since race conditions in the focus controller are one of our biggest recurring problems, can you briefly document the expectations of the potential main culprits, such as this one? Or maybe, we can have some SOP or recommended usage in a more centralized location that explains what will and what will not trigger race conditions?
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.
My bad. There should be an await
definitely.
I add this line before actually implement the function and forget to add the missing await
after making it an async function.
@@ -8,4 +8,11 @@ export default class GlobalErrorsChildNode extends TraceNode { | |||
buildChildren() { | |||
return this.childTraces.map(t => this.treeNodeProvider.buildNode(TraceNode, t, this)); | |||
} | |||
|
|||
getSelectedChildren() { |
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.
Should this function not be in TraceNode
?
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.
TraceNode
s have their own isSelected
method. getSelectedChildren
is for their parent but not TraceNode
themself.
@@ -33,6 +36,12 @@ export default class GlobalErrorsNode extends BaseTreeViewNode { | |||
return child; | |||
} | |||
} | |||
for (const child of this.children) { |
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.
can use this.children.find
instead
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.
Cannot simply use find
since it is a flatFind
(or findMap
) operation.
|
||
class SearchController { | ||
constructor() { | ||
this._emitter = new NanoEvents(); |
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.
Since this is a singleton, have you made sure that it gets reset when it is invalidated?
Specifically: this stores matches
, contexts
etc. When their application is deselected/removed, are you making sure that those invalid data points are not lingering?
Can you add at least part of the reset mechanic as a method to this class, so we can easily find where it happens, when necessary?
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.
Solution: re-search
every time ApplicationSelectionChanged
.
}, | ||
|
||
findContextsByTraceSearchTerm(dp, searchTerm) { | ||
searchTraces(dp, searchTerm) { |
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.
A bit of clean up - can you:
- move all search-related functions together
- rename
find
tosearch
- add a
comment-barrier-1
: "search" to mark the whole region
?
@@ -82,28 +66,23 @@ export default class ContextNodeManager extends HostComponentEndpoint { | |||
} | |||
|
|||
// TODO: makeDebounce | |||
refreshOnData = () => { | |||
refreshOnData = async () => { |
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.
Does this not need a makeDebounce
?
|
||
// propagate mode to sub graph | ||
const childMode = this.getChildMode(); | ||
for (const child of this.owner.children) { | ||
if (!hasGraphNode(child)) { | ||
this.logger.warn(`GraphNode owner's children contains no graphNode`); | ||
this.logger.warn(`GraphNode owner's children ${child.debugTag} contains no graphNode`); |
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.
This warning message is better, but still not very helpful to a dev who does not currently work on this exact feature. Usually, you want to add a bit more context information: at least we usually want to add which function/operation/feature caused this.
GlobalErrorNode.getSelectedChildren
TraceCollection
showError
should only traverse leavesSearchController
indbux-code
GlobalAnalysisView
SearchResultNode
on search#619