Skip to content

Commit

Permalink
Merge pull request #714 from Domiii/issue#702
Browse files Browse the repository at this point in the history
fix `traceAtCursor` missing traces in VirtualContexts
  • Loading branch information
Domiii authored Apr 6, 2022
2 parents 8a3d29a + 412b8cd commit 24a459a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
18 changes: 16 additions & 2 deletions dbux-data/src/dataProviderUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -1657,11 +1657,11 @@ export default {

/** @param {DataProvider} dp */
getRealStaticContextIdOfStaticContext(dp, staticContextId) {
const { parentId, type } = dp.collections.staticContexts.getById(staticContextId);
const { parentId } = dp.collections.staticContexts.getById(staticContextId);

// NOTE: "first virtual" context of context is "real context"

if (!isVirtualStaticContextType(type)) {
if (dp.util.isRealStaticContext(staticContextId)) {
return staticContextId;
}

Expand All @@ -1686,6 +1686,20 @@ export default {
// return realContext.staticContextId;
},

/** @param {DataProvider} dp */
isRealStaticContext(dp, staticContextId) {
const staticContext = dp.collections.staticContexts.getById(staticContextId);
if (!isVirtualStaticContextType(staticContext.type)) {
return true;
}
else if (staticContext.isInterruptable) {
// `isInterruptable === true` for the first virtual context
return true;
}

return false;
},

/** @param {DataProvider} dp */
getRealContextIdOfTrace(dp, traceId) {
const { contextId } = dp.collections.traces.getById(traceId);
Expand Down
3 changes: 1 addition & 2 deletions dbux-data/src/impl/indexes/TracesByRealStaticContextIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export default class TracesByRealStaticContextIndex extends CollectionIndex {
*/
makeKey(dp, trace) {
const { contextId } = trace;
const { staticContextId } = dp.collections.executionContexts.getById(contextId);
const realContextId = dp.util.getRealStaticContextIdOfStaticContext(staticContextId);
const realContextId = dp.util.getRealStaticContextIdOfContext(contextId);

return realContextId || 0;
}
Expand Down

0 comments on commit 24a459a

Please sign in to comment.