Skip to content

Commit

Permalink
Draft: Put limit info from Resolver tree request on state
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Kimmel committed Jun 18, 2020
1 parent 58f233a commit a46560e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ interface ServerReturnedResolverData {
readonly payload: {
readonly events: ResolverEvent[];
readonly stats: Map<string, ResolverNodeStats>;
}
readonly limitReached: boolean;
};
}

interface ServerFailedToReturnResolverData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ describe('resolver graph layout', () => {
describe('when rendering no nodes', () => {
beforeEach(() => {
const events: ResolverEvent[] = [];
const action: DataAction = { type: 'serverReturnedResolverData', payload: {events, stats: new Map()} };
const action: DataAction = {
type: 'serverReturnedResolverData',
payload: { events, stats: new Map() },
};
store.dispatch(action);
});
it('the graphableProcesses list should only include nothing', () => {
Expand All @@ -128,7 +131,10 @@ describe('resolver graph layout', () => {
describe('when rendering one node', () => {
beforeEach(() => {
const events = [processA];
const action: DataAction = { type: 'serverReturnedResolverData', payload: {events, stats: new Map()} };
const action: DataAction = {
type: 'serverReturnedResolverData',
payload: { events, stats: new Map() },
};
store.dispatch(action);
});
it('the graphableProcesses list should only include nothing', () => {
Expand All @@ -142,7 +148,10 @@ describe('resolver graph layout', () => {
describe('when rendering two nodes, one being the parent of the other', () => {
beforeEach(() => {
const events = [processA, processB];
const action: DataAction = { type: 'serverReturnedResolverData', payload: {events, stats: new Map()} };
const action: DataAction = {
type: 'serverReturnedResolverData',
payload: { events, stats: new Map() },
};
store.dispatch(action);
});
it('the graphableProcesses list should only include nothing', () => {
Expand All @@ -166,7 +175,10 @@ describe('resolver graph layout', () => {
processH,
processI,
];
const action: DataAction = { type: 'serverReturnedResolverData', payload: {events, stats: new Map()} };
const action: DataAction = {
type: 'serverReturnedResolverData',
payload: { events, stats: new Map() },
};
store.dispatch(action);
});
it("the graphableProcesses list should only include events with 'processCreated' an 'processRan' eventType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const dataReducer: Reducer<DataState, ResolverAction> = (state = initialS
...state,
results: action.payload.events,
relatedEventsStats: action.payload.stats,
limitReached: action.payload.limitReached,
isLoading: false,
hasError: false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const resolverMiddlewareFactory: MiddlewareFactory = (context) => {
}
const nodeStats: Map<string, ResolverNodeStats> = new Map();
nodeStats.set(entityId, stats);
const limitReached = children.nextChild !== null || ancestry.nextAncestor !== null;
const events = [
...lifecycle,
...getLifecycleEventsAndStats(children.childNodes, nodeStats),
Expand All @@ -87,7 +88,8 @@ export const resolverMiddlewareFactory: MiddlewareFactory = (context) => {
payload: {
events,
stats: nodeStats,
}
limitReached,
},
});
} catch (error) {
api.dispatch({
Expand Down

0 comments on commit a46560e

Please sign in to comment.