-
Notifications
You must be signed in to change notification settings - Fork 565
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
Add TypeScript support and demo small refactor #1792
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As if the types and data flows weren't complicated enough in this application, we have no support from the language or compiler to make sense of it all. In this patch we're adding TypeScript into the build pipeline to allow for writing modules in TypeScript and to aid us in knowing just what we are dealing with. Types are stripped from the modules before sending to Babel and so therefore we won't prevent a build just because there are type errors. This patch enables a certain level of autocomplete on `appState`, indicating which action creators are available.
There's an issue with false positives for type imports. typescript-eslint/typescript-eslint#363
belcherj
approved these changes
Dec 19, 2019
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.
This is great! Let's get this merged and continue to iterate.
dmsnell
added a commit
that referenced
this pull request
Jan 7, 2020
In #1792 I introduced a typo from `name` to `namer` and this prevented the tag drawer from working properly. That is, when trying to filter by tag it was looking for matches on `tag.data.namer` instead of on `tag.data.name` and unsuprisingly there were no matches. After this patch things are restored to normal working order.
dmsnell
added a commit
that referenced
this pull request
Jan 7, 2020
In #1792 I introduced a typo from `name` to `namer` and this prevented the tag drawer from working properly. That is, when trying to filter by tag it was looking for matches on `tag.data.namer` instead of on `tag.data.name` and unsuprisingly there were no matches. After this patch things are restored to normal working order.
dmsnell
added a commit
that referenced
this pull request
Jan 16, 2020
In paFIJd-8t it was reported that note corruption was occurring when viewing the history of one note when it gets updated remotely. Although this fix may or may not address that problem a code audit revealed that in #1792 I removed what appeared to be an unused function when it was in fact used by the component's `onClickOutside` wrapper. The missing handler function closed out of the revision slider when clicking anywhere else. Without it, the thread handling the click crashed but since it was a callback it didn't crash the app. A message appeared in the developer console indicating that the handler was missing. Because we haven't been closing the revision slider it has become possible to start editing a note while the revisions are still open, something prevented before by way of the click handler. Thus, if viewing a revision, clicking anywhere else, and continuing, then we fill the editor with what it thinks is a note (and not a revision) and then will respond to remote updates with the contents of that revision before accepting remote updates.
dmsnell
added a commit
that referenced
this pull request
Jan 17, 2020
In paFIJd-8t it was reported that note corruption was occurring when viewing the history of one note when it gets updated remotely. Although this fix may or may not address that problem a code audit revealed that in #1792 I removed what appeared to be an unused function when it was in fact used by the component's `onClickOutside` wrapper. The missing handler function closed out of the revision slider when clicking anywhere else. Without it, the thread handling the click crashed but since it was a callback it didn't crash the app. A message appeared in the developer console indicating that the handler was missing. Because we haven't been closing the revision slider it has become possible to start editing a note while the revisions are still open, something prevented before by way of the click handler. Thus, if viewing a revision, clicking anywhere else, and continuing, then we fill the editor with what it thinks is a note (and not a revision) and then will respond to remote updates with the contents of that revision before accepting remote updates.
dmsnell
added a commit
that referenced
this pull request
Jan 21, 2020
In paFIJd-8t it was reported that note corruption was occurring when viewing the history of one note when it gets updated remotely. Although this fix may or may not address that problem a code audit revealed that in #1792 I removed what appeared to be an unused function when it was in fact used by the component's `onClickOutside` wrapper. The missing handler function closed out of the revision slider when clicking anywhere else. Without it, the thread handling the click crashed but since it was a callback it didn't crash the app. A message appeared in the developer console indicating that the handler was missing. Because we haven't been closing the revision slider it has become possible to start editing a note while the revisions are still open, something prevented before by way of the click handler. Thus, if viewing a revision, clicking anywhere else, and continuing, then we fill the editor with what it thinks is a note (and not a revision) and then will respond to remote updates with the contents of that revision before accepting remote updates.
dmsnell
added a commit
that referenced
this pull request
Jan 21, 2020
In paFIJd-8t it was reported that note corruption was occurring when viewing the history of one note when it gets updated remotely. Although this fix may or may not address that problem a code audit revealed that in #1792 I removed what appeared to be an unused function when it was in fact used by the component's `onClickOutside` wrapper. The missing handler function closed out of the revision slider when clicking anywhere else. Without it, the thread handling the click crashed but since it was a callback it didn't crash the app. A message appeared in the developer console indicating that the handler was missing. Because we haven't been closing the revision slider it has become possible to start editing a note while the revisions are still open, something prevented before by way of the click handler. Thus, if viewing a revision, clicking anywhere else, and continuing, then we fill the editor with what it thinks is a note (and not a revision) and then will respond to remote updates with the contents of that revision before accepting remote updates. (cherry picked from commit 43bc2a5)
dmsnell
added a commit
that referenced
this pull request
Jan 21, 2020
In paFIJd-8t it was reported that note corruption was occurring when viewing the history of one note when it gets updated remotely. Although this fix may or may not address that problem a code audit revealed that in #1792 I removed what appeared to be an unused function when it was in fact used by the component's `onClickOutside` wrapper. The missing handler function closed out of the revision slider when clicking anywhere else. Without it, the thread handling the click crashed but since it was a callback it didn't crash the app. A message appeared in the developer console indicating that the handler was missing. Because we haven't been closing the revision slider it has become possible to start editing a note while the revisions are still open, something prevented before by way of the click handler. Thus, if viewing a revision, clicking anywhere else, and continuing, then we fill the editor with what it thinks is a note (and not a revision) and then will respond to remote updates with the contents of that revision before accepting remote updates. (cherry picked from commit 43bc2a5)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As if the types and data flows weren't complicated enough in this
application, we have no support from the language or compiler to make
sense of it all.
In this patch we're adding TypeScript into the build pipeline to allow
for writing modules in TypeScript and to aid us in knowing just what we
are dealing with.
Types are stripped from the modules before sending to Babel and so
therefore we won't prevent a build just because there are type errors.
This patch enables a certain level of autocomplete on
appState
,indicating which action creators are available.
Testing
Build the app and smoke-test it. I refactored some state code so basic
operations like loading notes should fail if anything is wrong.