[Frames] Simplify Redux call stacks
Here is a call stack from: perf.html running locally: link with a breakpoint in profile-view.js:97 I think there are a couple of things we could do to simplify it:
- group frames 2 - 9: action dispatch
- group frames 11 - 13: action dispatch
- group frames 14 - 21: resolve promise
In terms of algorithms:
- group frames that match redux or thread-middleware.
- group frames that match regenerator-runtime, core-js, or babel
- label frame groups action dispatch if you see combineReducers or createStore
- label frame groups resolve promise if you see
es6.promisein the group
Curious to see what others with more knowledge think.
Call Stack
1 - webpack:///src/content/reducers/profile-view.js
2 - webpack:///~/redux/es/combineReducers.js
3 - webpack:///~/redux/es/combineReducers.js
4 - webpack:///~/redux/es/combineReducers.js
5 - webpack:///~/redux/es/createStore.js
6 - webpack:///~/redux-logger/lib/index.js
7 - webpack:///src/common/thread-middleware.js
8 - webpack:///~/redux-thunk/lib/index.js
9 - webpack:///~/redux/es/applyMiddleware.js
10 - webpack:///src/content/actions/receive-profile.js
11 - webpack:///~/redux-thunk/lib/index.js
12 - webpack:///~/redux/es/applyMiddleware.js
13 - webpack:///src/content/actions/receive-profile.js
14 - webpack:///~/regenerator-runtime/runtime.js
15 - webpack:///~/regenerator-runtime/runtime.js
16 - webpack:///~/regenerator-runtime/runtime.js
17 - webpack:///~/babel-runtime/helpers/asyncToGenerator.js
18 - webpack:///~/babel-runtime/helpers/asyncToGenerator.js
19 - webpack:///~/core-js/library/modules/es6.promise.js
20 - webpack:///~/core-js/library/modules/es6.promise.js
21 - webpack:///~/core-js/library/modules/_microtask.js
Screenshot
Steps to get started
- go to https://github.com/devtools-html/perf.html/
- git clone, npm install, npm start
- add a breakpoint in
reducers/profile-view.js
I'm not sure where _callee7$ is specifically coming from, somewhere in the thunk. It would be nice to have a clear stack showing receiveProfileFromAddon with the Redux pseudo stacks in there. The general principle would be nice to only show me what I really care about.
hmm - i know what you're saying. I bet we can do something with function names and babel... Like go up and get the real name...
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/unclaim
Done :+1:
Here are two use cases
go to localhost:8000 select a tab and add breakpoints at reducers/ast.js#83 (set_symbols) and actions/ast.js#47 (setSymbols).
In both cases we have redux dispatch frames that can be grouped with this algorithm: group everything ending in dispatch w/ applyMiddleware and beginning with combination, thunk, or dispatch
| Reducer | Action |
|---|---|
| ![red] | ![act] |
| [act]:https://shipusercontent.com/6f1907e5efe2e216fe64f68622a6dfdd/Screen%20Shot%202018-03-27%20at%2010.05.20%20AM.png | |
| [red]:https://shipusercontent.com/1a887ecd5d626dc6620c2f44660818f7/Screen%20Shot%202018-03-27%20at%2010.06.46%20AM.png |
Here's an example:
Original
update (ast.js#83)
combination (combineReducers.js#120)
dispatch (createStore.js#165)
timing (timing.js#25)
waitUntilService (wait-service.js#62)
promiseMiddleware (promise.js#28)
thunk (thunk.js#25)
dispatch (applyMiddleware.js#35)
promiseMiddleware (promise.js#38)
thunk (thunk.js#25)
dispatch (applyMiddleware.js#35)
setSymbols (ast.js#57)
thunk (thunk.js#24)
dispatch (applyMiddleware.js#35)
selectLocation (select.js#137)
Groups
update (ast.js#83)
dispatch (10) Redux
combination (combineReducers.js#120)
dispatch (createStore.js#165)
timing (timing.js#25)
waitUntilService (wait-service.js#62)
promiseMiddleware (promise.js#28)
thunk (thunk.js#25)
dispatch (applyMiddleware.js#35)
promiseMiddleware (promise.js#38)
thunk (thunk.js#25)
dispatch (applyMiddleware.js#35)
setSymbols (ast.js#57)
dispatch (2) Redux
thunk (thunk.js#24)
dispatch (applyMiddleware.js#35)
selectLocation (select.js#137)
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
I had a Jest test written up in this branch but I'm no longer sure how to go about this. How would we distinguish a regular app frame (e.g. setSymbols (ast.js#57) from custom middleware (e.g. promiseMiddleware?
hmm, can you share an example stack?
For sure! Take the one you gave above. Here's the Jest test case for it.
Lemme rephrase what I've been saying: It would be super easy to make the above test pass. The hard thing is doing it in a way that would make it scale to other use cases in projects other than our own. Actually... that got me thinking: maybe we just have the wrong test case... Or I'm looking at something the wrong way.
I'm closing this issue and moving it to the icebox, because this is something I do not think we will bet to this quarter. We will review the icebox queue in the next quarter and possibly add it to the roadmap.