Skip to content

Commit b3d67fe

Browse files
committed
Bugfix: break quick-look toast/content import cycle
`QuickLookHintToastContent.svelte` imported `QUICK_LOOK_HINT_TOAST_ID` from `quick-look-hint.ts`, which in turn imports the component to feed `addToast`. Extract the constant to a tiny `quick-look-hint-id.ts` module so both sides depend on the leaf, not each other. Unblocks the `import-cycles` check.
1 parent a3e15f4 commit b3d67fe

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

apps/desktop/src/lib/file-explorer/quick-look/QuickLookHintToastContent.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { setSetting } from '$lib/settings'
1919
import { openSettingsWindow } from '$lib/settings/settings-window'
2020
21-
import { QUICK_LOOK_HINT_TOAST_ID } from './quick-look-hint'
21+
import { QUICK_LOOK_HINT_TOAST_ID } from './quick-look-hint-id'
2222
2323
function handleOpenSettings() {
2424
dismissToast(QUICK_LOOK_HINT_TOAST_ID)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Toast ID for the Quick Look educational hint. Split into its own file so
3+
* `quick-look-hint.ts` (which renders the toast) and `QuickLookHintToastContent.svelte`
4+
* (which dismisses it) can both reference the constant without forming a cycle.
5+
*/
6+
export const QUICK_LOOK_HINT_TOAST_ID = 'quick-look-hint'

apps/desktop/src/lib/file-explorer/quick-look/quick-look-hint.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ import { getSetting } from '$lib/settings'
3030
import { addToast, getToasts } from '$lib/ui/toast'
3131

3232
import QuickLookHintToastContent from './QuickLookHintToastContent.svelte'
33+
import { QUICK_LOOK_HINT_TOAST_ID } from './quick-look-hint-id'
3334

34-
export const QUICK_LOOK_HINT_TOAST_ID = 'quick-look-hint'
35+
export { QUICK_LOOK_HINT_TOAST_ID }
3536

3637
/**
3738
* Show the Quick Look hint toast unless (a) the user has permanently opted

0 commit comments

Comments
 (0)