Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

benmccann
Copy link
Contributor

@benmccann benmccann commented Feb 18, 2024

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

Copy link

cloudflare-pages bot commented Feb 18, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 91361c3
Status: ✅  Deploy successful!
Preview URL: https://5a17f3b8.immich.pages.dev
Branch Preview URL: https://migrate-more.immich.pages.dev

View logs

on:outclick={() => !ignoreClickOutside && dispatch('close')}
on:escape={() => dispatch('escape')}
on:outclick={() => !ignoreClickOutside && onClose && onClose()}
on:escape={() => onEscape && onEscape()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
on:escape={() => onEscape && onEscape()}
on:escape={() => onEscape?.()}

Copy link
Contributor

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}
Copy link
Contributor

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>;

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants