-
Notifications
You must be signed in to change notification settings - Fork 2
Implement text prediction functionality #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
HeitorBoschirolli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm too sleepy to continue. Stopped at "Add uuid as a dependency". Will finish tomorrow
| // on connection closed event callback | ||
| socket.current.onclose = (event) => | ||
| { | ||
| console.log("Websocket connection closed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should log event.code as well. This way we can differentiate connections closed normally unexpected behavior. And we should try to reconnect if the WebSocket closes
suggestion:
if (event.code === 1000)
console.log('Websocket connection closed cleanly');
else
{
console.log(`Websocket connection closed uncleanly. code: ${event.code}, trying to reconnect`);
socket.current = new WebSocket(CONNECTION_ADDRESS);
}
| <Popover | ||
| content={<p style={{ color: '#a7425c' }}>Coming soon</p>} | ||
| trigger="hover" | ||
| > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return( | ||
| <Popover | ||
| content={<p style={{ color: '#a7425c' }}>Coming soon</p>} | ||
| content={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you're changing functionality added in this PR. Ideally, we would squash some commits or split this into two PRs. Do you think it's worth the trouble?
| color: '#a7425c' | ||
| }} | ||
| > | ||
| Prediction size: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cool to show the current prediction size. We open an issue for this if you prefer.
| "marked": "^0.8.0", | ||
| "react": "^16.12.0", | ||
| "react-dom": "^16.12.0", | ||
| "react-redux": "^7.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From this point forward it definitely seems like it should be a new PR. Again, do you think it's work the trouble? It could be a single PR with two version updates as well
| */ | ||
| function setMaxSize(size) { | ||
| return { | ||
| type: 'SET_MAX_SIZE', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think there's benefit in centralizing the actions strings in a separate file as constants so we always use the same thing in actions and reducers?
for example:
actions/types.js
export SET_MAX_SIZE = 'SET_MAX_SIZE';
actions/predictions.js
import {SET_MAX_SIZE} from '../types';
...
type: SET_MAX_SIZE
...
reducers/predictions.js
import {SET_MAX_SIZE} from '../../actions/types';
...
case SET_MAX_SIZE:
...
Advantages I see: no errors caused by typos related to action names.
Disadvantages I see: more lines of code and a more complex file structure.
| * @component | ||
| */ | ||
| function Content() | ||
| function Content({socket}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WebSocket could be in the Store

No description provided.