@@ -52,7 +52,7 @@ function ActionContainer(props): JSX.Element {
52
52
displayName : `${ obj . name } .${ obj . branch } ` ,
53
53
state : obj . stateSnapshot . children [ 0 ] . state ,
54
54
componentName : obj . stateSnapshot . children [ 0 ] . name ,
55
- routePath : obj . stateSnapshot . url ,
55
+ routePath : obj . stateSnapshot . route . url ,
56
56
// nathan testing new entries for component name, original above
57
57
// componentName: findDiff(obj.index),
58
58
componentData :
@@ -146,28 +146,15 @@ function ActionContainer(props): JSX.Element {
146
146
setRecordingActions ( ! recordingActions ) ;
147
147
} ;
148
148
149
- // Logic to create the components for the route descriptions.
150
- // Create a cache that will be an array of all the route paths.
151
- const cache = [ ] ;
149
+ // Logic to create the route description components
150
+ const routes = { } ;
152
151
for ( let i = 0 ; i < actionsArr . length ; i ++ ) {
153
- if ( ! cache . includes ( actionsArr [ i ] . props . routePath ) ) {
154
- cache . push ( actionsArr [ i ] . props . routePath ) ;
152
+ if ( ! routes . hasOwnProperty ( actionsArr [ i ] . props . routePath ) ) {
153
+ routes [ actionsArr [ i ] . props . routePath ] = [ actionsArr [ i ] ] ;
154
+ } else {
155
+ routes [ actionsArr [ i ] . props . routePath ] . push ( actionsArr [ i ] ) ;
155
156
}
156
157
}
157
- // Create cache2 as an object route path as a key and the individual-actions as the value.
158
- const cache2 = { } ;
159
- for ( const element of cache ) {
160
- cache2 [ element ] = [ ] ;
161
- }
162
- // Create a conditional that will check if the individual-action matches the route path and add it to the cache2.
163
- for ( let i = 0 ; i < actionsArr . length ; i ++ ) {
164
- for ( const key in cache2 ) {
165
- if ( actionsArr [ i ] . props . routePath === key ) {
166
- cache2 [ key ] . push ( actionsArr [ i ] ) ;
167
- }
168
- }
169
- }
170
-
171
158
172
159
// the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
173
160
// UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
@@ -211,10 +198,10 @@ function ActionContainer(props): JSX.Element {
211
198
Clear
212
199
</ button >
213
200
</ div >
214
- { /* Rendering of the cache2 component */ }
215
- { Object . keys ( cache2 ) . map ( ( element ) => {
201
+ { /* Rendering of route description components */ }
202
+ { Object . keys ( routes ) . map ( ( route ) => {
216
203
return (
217
- < RouteDescription actions = { cache2 [ element ] } > </ RouteDescription >
204
+ < RouteDescription actions = { routes [ route ] } > </ RouteDescription >
218
205
)
219
206
} ) }
220
207
</ div >
0 commit comments