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
[WIP] Migrate React static components to Flow component syntax #3231
Draft
reosarevok
wants to merge
68
commits into
metabrainz:master
Choose a base branch
from
reosarevok:flow-component-syntax-static
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[WIP] Migrate React static components to Flow component syntax #3231
reosarevok
wants to merge
68
commits into
metabrainz:master
from
reosarevok:flow-component-syntax-static
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
reosarevok
force-pushed
the
flow-component-syntax-static
branch
2 times, most recently
from
April 15, 2024 11:31
a69b1c8
to
6b48155
Compare
This is only used in one place, so there's no need to have a separate types file just for it.
This is only used in one place, so there's no need to have a separate types file just for it.
This is only used in one place, so there's no need to have it in a separate types file.
This is only used in one place, so there's no need to have it in a separate types file.
This is only used in one place, so there's no need to have it in a separate types file.
In order to make use of the benefits of the syntax, converted components/TagEntiesList here too so I can use its props to avoid defining things twice.
Flow wasn't happy with us passing variables we don't use as part of props. I made some changes on how we do typing here that actually allowed me to drop the separate types file entirely.
No changes to text content, all changes are moving words around for max-len purposes
For VoteCheckbox in Vote.js, Flow was unhappy with us passing a generic ...props to the input, since in theory the props can contain different name, type etc from what we're passing separately. This just changes it to pass value specifically, which seems to be the intention based on Flow typing.
Instance is optional and defaults to mixed. See https://flow.org/en/docs/react/types/#toc-react-abstractcomponent This also causes issues when an input component's type does not have a void instance.
Modal doesn't actually use its onClick prop at all, so this is dead code. It seems it's not needed either.
… component syntax Except for class components which should be converted but are less trivial to change.
…omponent syntax Multiselect needs a lot of changes to fix the Flow issues hidden by FlowIgnore, will look into it in a separate commit. AddEntityDialog needs a ref fix.
These are already the default exports
reosarevok
force-pushed
the
flow-component-syntax-static
branch
from
April 16, 2024 09:10
6b48155
to
41c6844
Compare
reosarevok
force-pushed
the
flow-component-syntax-static
branch
from
April 26, 2024 09:39
41c6844
to
3d550a1
Compare
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.
Flow now supports a specific React Component Syntax which reduces the amount of types we need to define manually, and is supposed to be better for type checking as well. I'm converting our React components to this syntax bit by bit with this PR.
This changes all stuff in the
static
subfolder, except for class components which require a lot more changes and can be done later.Note: To be reviewed without whitespace changes (since this adds explicit
return()
calls that require spacing things one more tab in many cases).On top of #3236