-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
chore: migrate more createEventDispatcher calls #7187
Conversation
Deploying with Cloudflare Pages
|
0e517fe
to
c78c951
Compare
c78c951
to
e3c9728
Compare
on:outclick={() => !ignoreClickOutside && dispatch('close')} | ||
on:escape={() => dispatch('escape')} | ||
on:outclick={() => !ignoreClickOutside && onClose && onClose()} | ||
on:escape={() => onEscape && onEscape()} |
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.
on:escape={() => onEscape && onEscape()} | |
on:escape={() => onEscape?.()} |
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.
FYI: You can use the ?.
null-ish chaining operator even when invoking functions
on:newAlbum={({ detail }) => handleAddToNewAlbum(detail)} | ||
on:album={({ detail }) => handleAddToAlbum(detail)} | ||
on:close={() => (isShowAlbumPicker = false)} | ||
onNewAlbum={handleAddToNewAlbum} |
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 handlers have a return signature of void, but the actual handler if often async. If svelte-check does catch that, it could be a problem.
Ideally, you would need to make the handler like this, and then you'd be forced to await it.
export let onNewAlbum: (search: string) => Promise<unknown>;
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.
Yeah, I'm trying to figure out why svelte-check
/eslint
aren't catching it. That's why I sent the eslint PR (#7382), which I expected would catch this. Unfortunately, it's still not. Perhaps it's an issue with eslint-plugin-svelte
since it's in the Svelte markup portion of the template. I'm leaving this broken and in draft mode until I track it down as I'm more concerned with having an automated check to avoid the error than fixing this particular instance of it. Next step on that journey is here: #7471
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 filed an issue in the eslint-plugin-svelte
repo: sveltejs/eslint-plugin-svelte#691
I'm going to close this PR until that's implemented as it's too hard to keep everything straight without the linter's help
e3c9728
to
91361c3
Compare
Not ready yet... I think it might not be making some things async that should be. I need to check and see why
svelte-check
isn't catching these