Skip to content

Commit b321d1f

Browse files
joeeparkfscgoldenRobbyTiptondavidkim7773khobread
committed
Finished RouteDescription with Code Review. Still need to add typescript compatibility
Co-authored-by: Chris LeBrett <[email protected]> Co-authored-by: Robby Tipton <[email protected]> Co-authored-by: Joseph Park <[email protected]> Co-authored-by: David Kim <[email protected]> Co-authored-by: Kevin HoEun Lee <[email protected]>
1 parent d725735 commit b321d1f

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

src/app/components/RouteDescription.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
22

33
const RouteDescription = (props) => {
4+
// Use new URL to use the url.pathname method.
45
const url = new URL(props.actions[0].props.routePath);
56
return (
67
<div className="routedescription">

src/app/containers/ActionContainer.tsx

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function ActionContainer(props): JSX.Element {
5252
displayName: `${obj.name}.${obj.branch}`,
5353
state: obj.stateSnapshot.children[0].state,
5454
componentName: obj.stateSnapshot.children[0].name,
55-
routePath: obj.stateSnapshot.url,
55+
routePath: obj.stateSnapshot.route.url,
5656
// nathan testing new entries for component name, original above
5757
// componentName: findDiff(obj.index),
5858
componentData:
@@ -146,28 +146,15 @@ function ActionContainer(props): JSX.Element {
146146
setRecordingActions(!recordingActions);
147147
};
148148

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 = {};
152151
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]);
155156
}
156157
}
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-
171158

172159
// the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
173160
// UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
@@ -211,10 +198,10 @@ function ActionContainer(props): JSX.Element {
211198
Clear
212199
</button>
213200
</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) => {
216203
return (
217-
<RouteDescription actions = {cache2[element]}></RouteDescription>
204+
<RouteDescription actions = {routes[route]}></RouteDescription>
218205
)
219206
})}
220207
</div>

src/backend/linkFiber.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ function sendSnapshot(snap: Snapshot, mode: Mode): void {
9494
}
9595
const payload = snap.tree.cleanTreeCopy();
9696
// if it's Recoil - run different actions
97-
payload.url = window.location.href;
9897
if (isRecoil) {
9998
// getRecoilState()
10099
payload.atomsComponents = atomsComponents;

0 commit comments

Comments
 (0)