Skip to content

Commit bf855e0

Browse files
committed
Merge branch and dev readme updates
1 parent 6861e81 commit bf855e0

File tree

1 file changed

+43
-18
lines changed

1 file changed

+43
-18
lines changed

src/README.md

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,47 @@ Similar approach for Next.js and Remix demo apps
4747
<img src="./assets/reactime-dev-setup.gif" />
4848
</p>
4949

50-
<h2>Documentation for Consideration</h2>
51-
<h4>Can Reactime be integrated with Redux compatibility so applications using Redux can track state in Reactime?</h4>
52-
Yes, but it would be very time-consuming and not the most feasible option while Redux devtools exists already. With how Redux devtools is currently set up, a developer is unable to use Redux devtools as a third-party user and integrate its functionality into their own application, as Redux devtools is meant to be used directly on an application using Redux for state-tracking purposes. Since the devtools do not appear to have a public API for integrated use in an application or it simply does not exist, Redux devtools would need to be rebuilt from the ground up and then integrated into Reactime, or built into Reactime directly still from scratch.
53-
4. Go to `chrome://extensions`
54-
5. Ensure Developer mode is enabled
55-
6. Click `Load unpacked`
56-
7. Select the `src/extension/build` directory
50+
# For Future Iterators
51+
Here are some notes on the current state of Reactime and considerations for future development.
52+
53+
54+
55+
56+
57+
## Testing
58+
59+
For Reactime unit tests, pre-v.19 there were tests built out in two places. Backend tests were in backend >\__tests__. Frontend tests were in src > app >\__tests__. In v19, we specifically focused on rebuilding front tests to use React Testing Library (RTL) + Jest. Previously, front end testing existed but utilized Enzyme + Jest . Our decision to move to RTL stemmed on the fact that Enzyme did not support React V17 (third party Enzyme adaptor libraries were created to provide support to previous React versions, but were still very much out of date) and that Enzyme is no longer industry standard. We began the process of creating new frontend tests but they are not complete and this is a great place for future iterators to build out more. Since the new suite of RTL tests are not fully complete, we have kept the older Enzyme tests within the codebase to be referenced (src > app > __tests__enzyme). However, these will not be included in the tests run in the testing scripts.
60+
61+
## Including Support for Hooks Beyond useState
62+
Reactime currently shows data stored via useState, but does not show data stored via other hooks such as useContext or useReducer. While showing this data would be simple, maintaining the time travel functionality of Reactime with these hooks would not. Please see file demo-app/src/client/Components/ButtonsWithMoreHooks.jsx for more details.
63+
64+
To see how hook data is stored in the fiber tree:
65+
66+
1. Change demo-app/src/client/Router.tsx to use utilize the ButtonsWithMoreHooks component
67+
2. Have the “Load Unpacked” version of Reactime in your chrome extension.
68+
3. Add console.logs in src/backend/routers/linkFiber.ts to log the fiber tree captured for a running app. In this case it'll be the demo-app
69+
4. Run Reactime on your computer via "npm run dev", which links your local Reactime to the “Load Unpacked” chrome extension.
70+
5. Run the demo-app from a separate terminal that's currently in the demo-app directory via "npm run dev"
71+
6. Navigate through the fiber tree in the console until you find the tree node for demo-app/src/client/Components/IncrementWithMoreHooks.jsx to see hook data.
72+
73+
Any changes to console.logs in Reactime can be seen by refreshing the browser the app is running in.
5774

58-
Now you should be able to change Reactime code and see the changes instantly reflected in your browser!
5975

60-
<b>With release of Node v18.12.1 (LTS) on 11/4/22, the script has been updated to 'npm run dev' | 'npm run build' for backwards compatibility.<br/>
61-
For version Node v16.16.0, please use script 'npm run devlegacy' | 'npm run buildlegacy'</b>
76+
## Redux
77+
78+
Can Reactime be integrated with Redux compatibility so applications using Redux can track state in Reactime?
79+
80+
Yes, but it would be very time-consuming and not the most feasible option while Redux devtools exists already. With how Redux devtools is currently set up, a developer is unable to use Redux devtools as a third-party user and integrate its functionality into their own application, as Redux devtools is meant to be used directly on an application using Redux for state-tracking purposes. Since the devtools do not appear to have a public API for integrated use in an application or it simply does not exist, Redux devtools would need to be rebuilt from the ground up and then integrated into Reactime, or built into Reactime directly still from scratch.
81+
6282

6383
## Quick Tips
6484

6585
- _Before_ beginning development, especially on teams, make sure to configure your linter and code formatting to conform to one unified setting (We recommend [the Airbnb style guide](https://github.com/airbnb/javascript)!) This will make reviewing PRs much more readable and less error-prone.
6686

67-
## File Structure
87+
- With release of Node v18.12.1 (LTS) on 11/4/22, the script has been updated to 'npm run dev' | 'npm run build' for backwards compatibility.<br/>
88+
For version Node v16.16.0, please use script 'npm run devlegacy' | 'npm run buildlegacy'
89+
90+
# File Structure
6891

6992
In the _src_ folder, there are three directories we care about: _app_, _backend_, and _extension_.
7093

@@ -115,6 +138,10 @@ src/
115138
└──
116139
```
117140

141+
# Diagrams
142+
143+
All the diagrams of data flows are avaliable on [MIRO](https://miro.com/app/board/uXjVPictrsM=/)
144+
118145
1. The _app_ folder is responsible for the Single Page Application that you see when you open the chrome dev tools under the Reactime tab.
119146

120147
![FRONTEND DATA FLOW](../assets/frontend-diagram.png)
@@ -130,9 +157,6 @@ src/
130157
- Like regular web apps, Chrome Extensions are event-based. The background script is where one typically monitors for browser triggers (e.g. events like closing a tab, for example). The content script is what allows us to read or write to our target web application, usually as a result of [messages passed](https://developer.chrome.com/extensions/messaging) from the background script.
131158
- These two files help us handle requests both from the web browser and from the Reactime extension itself
132159

133-
## Diagramming
134-
135-
All the diagrams of data flows are avaliable on [MIRO](https://miro.com/app/board/uXjVPictrsM=/)
136160

137161
## Data Flow Architecture
138162

@@ -147,11 +171,12 @@ The general flow of data is described in the following steps:
147171
3. Likewise, when Reactime emits an action due to user interaction -- a "jump" request for example -- a message will be passed from Reactime via the background script to the content script. Then, the content script will pass a message to the target application containing a payload that represents the state the user wants the DOM to reflect or "jump" to.
148172
- One important thing to note here is that this jump action must be dispatched in the target application (i.e. _backend_ land), because only there do we have direct access to the DOM.
149173

150-
## Reacti.me Website:
174+
175+
# Reacti.me Website:
151176

152177
See [Reacti.me README](https://github.com/reactimetravel/reactime-website/blob/main/README.md) for instruction of how to update the website
153178

154-
## Console.log
179+
# Console logs
155180

156181
Navigation between different console.log panels can be confusing when running Reactime. We created a short instruction where you can find the results for your console.log
157182

@@ -182,7 +207,7 @@ Console.logs from the App folder you can find here:
182207

183208
![backend](../assets/reactime-console.gif)
184209

185-
## Chrome Developer Resources
210+
# Chrome Developer Resources
186211

187212
Still unsure about what content scripts and background scripts do for Reactime, or for a chrome extensions in general?
188213

@@ -214,7 +239,7 @@ Some relevant sections are reproduced below:
214239
2. The chrome extension "front-end" **(_NOT_ the interface of the browser, this is an important distinction.)**
215240
- In other words, a background script works as a sort of middleman, directly maintaining connection with its parent extension, and acting as a proxy enabling communication between it and the content script.
216241

217-
## Past Medium Articles for Reference
242+
# Past Medium Articles for Reference
218243
- [Reactime 19: What time is it? It’s still Reactime!](https://medium.com/@minzo.kim/what-time-is-it-its-still-reactime-d496adfa908c)
219244
- [Reactime 18.0. Better than ever](https://medium.com/@zdf2424/reactime-18-0-better-than-ever-148b81606257)
220245
- [Reactime v17.0.0: Now with support for the Context API, and a modern UI](https://medium.com/@reactime/reactime-v17-0-0-now-with-support-for-the-context-api-and-a-modern-ui-f0edf9e54dae)

0 commit comments

Comments
 (0)