-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat(modal): Port ServerIdentity (closes #112) #250
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Not sure if still needed, but the issue was still labeled as "help-wanted" so I spruced up and finished the draft PR from before. 👍 |
I have read the CLA Document and I hereby sign the CLA |
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've left some suggestions regarding types in some functions in ServerIdentity.tsx
Other than that, LGTM
const [avatarId, setAvatarId] = createSignal(null); | ||
const [uploading, setUploading] = createSignal<boolean>(); | ||
|
||
async function uploadToAutumn(file) { |
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.
You should use File | Blob
instead of not providing a type (aka. implicit any
) since the FileList
type is just an array of File
s (See MDN's article on FileList: https://developer.mozilla.org/en-US/docs/Web/API/FileList)
async function uploadToAutumn(file) { | |
async function uploadToAutumn(file) { |
|
||
const handleFileSelect = async (event: Event) => { | ||
const file = event.target?.files[0]; | ||
const json = await uploadToAutumn(file); |
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 target
property in Event
isn't guaranteed to be HTMLInputElement
, so typescript doesn't know whether the files
property actually exists or not and throws a error.
const json = await uploadToAutumn(file); | |
const handleFileSelect = async (event: Event & {target: HTMLInputElement}) => { |
|
||
const handleFileSelect = async (event: Event) => { | ||
const file = event.target?.files[0]; | ||
const json = await uploadToAutumn(file); |
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.
const json = await uploadToAutumn(file); | |
const handleFileSelect = async (event: Event & {target: HTMLInputElement}) => { |
|
||
const handleFileSelect = async (event: Event) => { | ||
const file = event.target?.files[0]; | ||
const json = await uploadToAutumn(file); |
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.
Typescript says that files
can be null, so it's better to use the non-null assertion operator to tell it to shut up.
const json = await uploadToAutumn(file); | |
const file = event.target?.files![0]; |
|
||
const handleFileSelect = async (event: Event) => { | ||
const file = event.target?.files[0]; | ||
const json = await uploadToAutumn(file); |
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.
const json = await uploadToAutumn(file); | |
const file = event.target.files![0]; |
PR went stale, feedback not actioned / responded to, closing out for now |
Please make sure to check the following tasks before opening and submitting a PR