Skip to content

Submit custom search on enter#489

Open
valentin9 wants to merge 1 commit intomaxdorninger:masterfrom
valentin9:custom-search-enter
Open

Submit custom search on enter#489
valentin9 wants to merge 1 commit intomaxdorninger:masterfrom
valentin9:custom-search-enter

Conversation

@valentin9
Copy link

@valentin9 valentin9 commented Mar 11, 2026

Simple fix to allow pressing enter on custom search dialog in addition to the "Search" button.


Checklist:

  • run npm run lint
  • run npm run format
  • manually tested using local dev

Summary by CodeRabbit

  • Bug Fixes
    • Fixed form submission in the custom download dialog so pressing Enter triggers search (in addition to clicking the Search button), restoring standard form behaviour and keyboard-friendly use.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

📝 Walkthrough

Walkthrough

Wrapped the input, button and description in a form using on:submit|preventDefault to trigger search; the Search button is now type="submit", enabling Enter-key submission while preserving labels, placeholder and existing search logic.

Changes

Cohort / File(s) Summary
Form semantics refactor
web/src/lib/components/download-dialogs/download-custom-dialog.svelte
Added a `<form on:submit

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 I hopped a change into tidy form,
Enter now skips the extra storm,
Same search heart, new proper door,
Quick keystroke finds what I adore! 🔎

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Submit custom search on enter' is concise (29 characters, well under 50), directly describes the main change in the pull request, and accurately summarises the modification to enable form submission on enter key press.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
web/src/routes/dashboard/+page.svelte (1)

10-10: Inconsistent import path with .d.ts extension.

The import uses '$lib/api/api.d.ts' with the explicit .d.ts extension, whereas all other files in this PR import from '$lib/api/api' without the extension. This inconsistency could cause issues if the module structure changes.

♻️ Suggested fix
-import type { MetaDataProviderSearchResult } from '$lib/api/api.d.ts';
+import type { MetaDataProviderSearchResult } from '$lib/api/api';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/routes/dashboard/`+page.svelte at line 10, Update the type import to
use the module path without the explicit .d.ts extension to match other files:
replace the import of MetaDataProviderSearchResult from '$lib/api/api.d.ts' with
an import from '$lib/api/api' (keep it as a type import). Locate the import
statement referencing MetaDataProviderSearchResult in +page.svelte and adjust
the module specifier only; do not change the imported symbol name or its usage
elsewhere.
web/src/routes/dashboard/movies/add-movie/+page.svelte (1)

42-42: Consider removing the redundant type cast.

The client.GET('/api/v1/movies/search', ...) and client.GET('/api/v1/movies/recommended') endpoints already return MetaDataProviderSearchResult[] according to the OpenAPI schema (see api.d.ts lines 3206-3236 and 3238-3268). The explicit cast is unnecessary as TypeScript should infer the correct type.

♻️ Proposed simplification
 			if (data && data.length > 0) {
-				results = data as MetaDataProviderSearchResult[];
+				results = data;
 			} else {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/routes/dashboard/movies/add-movie/`+page.svelte at line 42, The
assignment includes a redundant type cast to MetaDataProviderSearchResult[];
remove the explicit cast and let TypeScript infer the type from the
client.GET('/api/v1/movies/search', ...) and
client.GET('/api/v1/movies/recommended') responses — replace "results = data as
MetaDataProviderSearchResult[];" with "results = data;" (keeping the existing
results variable and ensuring it’s typed appropriately where declared) so the
code relies on the OpenAPI-generated types instead of an unnecessary assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/src/routes/dashboard/`+page.svelte:
- Line 10: Update the type import to use the module path without the explicit
.d.ts extension to match other files: replace the import of
MetaDataProviderSearchResult from '$lib/api/api.d.ts' with an import from
'$lib/api/api' (keep it as a type import). Locate the import statement
referencing MetaDataProviderSearchResult in +page.svelte and adjust the module
specifier only; do not change the imported symbol name or its usage elsewhere.

In `@web/src/routes/dashboard/movies/add-movie/`+page.svelte:
- Line 42: The assignment includes a redundant type cast to
MetaDataProviderSearchResult[]; remove the explicit cast and let TypeScript
infer the type from the client.GET('/api/v1/movies/search', ...) and
client.GET('/api/v1/movies/recommended') responses — replace "results = data as
MetaDataProviderSearchResult[];" with "results = data;" (keeping the existing
results variable and ensuring it’s typed appropriately where declared) so the
code relies on the OpenAPI-generated types instead of an unnecessary assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1cd11b30-7c0f-4771-9eb0-44da8f219dde

📥 Commits

Reviewing files that changed from the base of the PR and between f525399 and e030121.

📒 Files selected for processing (32)
  • web/package.json
  • web/src/lib/api/api.d.ts
  • web/src/lib/components/add-media-card.svelte
  • web/src/lib/components/delete-media-dialog.svelte
  • web/src/lib/components/download-dialogs/download-custom-dialog.svelte
  • web/src/lib/components/download-dialogs/download-movie-dialog.svelte
  • web/src/lib/components/download-dialogs/download-season-dialog.svelte
  • web/src/lib/components/download-dialogs/download-selected-episodes-dialog.svelte
  • web/src/lib/components/download-dialogs/download-selected-seasons-dialog.svelte
  • web/src/lib/components/download-dialogs/file-path-suffix-selector.svelte
  • web/src/lib/components/download-dialogs/select-file-path-suffix-dialog.svelte
  • web/src/lib/components/import-media/import-candidates-dialog.svelte
  • web/src/lib/components/import-media/suggested-media-card.svelte
  • web/src/lib/components/library-combobox.svelte
  • web/src/lib/components/nav/user-details.svelte
  • web/src/lib/components/recommended-media-carousel.svelte
  • web/src/lib/components/torrents/edit-torrent-dialog.svelte
  • web/src/lib/components/torrents/torrent-table.svelte
  • web/src/lib/components/user-data-table.svelte
  • web/src/lib/utils.ts
  • web/src/routes/dashboard/+layout.svelte
  • web/src/routes/dashboard/+page.svelte
  • web/src/routes/dashboard/movies/+page.svelte
  • web/src/routes/dashboard/movies/[movieId=uuid]/+page.svelte
  • web/src/routes/dashboard/movies/add-movie/+page.svelte
  • web/src/routes/dashboard/notifications/+page.svelte
  • web/src/routes/dashboard/settings/+page.svelte
  • web/src/routes/dashboard/tv/+page.svelte
  • web/src/routes/dashboard/tv/[showId=uuid]/+page.svelte
  • web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.svelte
  • web/src/routes/dashboard/tv/add-show/+page.svelte
  • web/src/routes/login/+page.svelte
📜 Review details
🔇 Additional comments (34)
web/src/routes/dashboard/notifications/+page.svelte (1)

9-13: LGTM!

The type import refactoring from nested components['schemas']['Notification'] to direct Notification type import is clean and consistent with the broader PR pattern. The variable type annotations are correctly updated.

web/src/lib/components/delete-media-dialog.svelte (1)

2-2: LGTM!

The type import refactoring correctly uses PublicMovie | PublicShow which matches the API response types. This is consistent with the broader migration to explicit public type exports.

Also applies to: 17-17

web/src/lib/components/nav/user-details.svelte (1)

3-4: LGTM!

Clean type import refactoring from nested schema reference to direct UserRead type. The context type annotation is correctly updated.

web/src/lib/components/download-dialogs/download-season-dialog.svelte (1)

13-13: LGTM!

The type import refactoring correctly uses the direct Show type import. The component accesses show.id and show.seasons which are present in the Show schema.

Also applies to: 20-20

web/src/lib/components/download-dialogs/download-custom-dialog.svelte (2)

10-10: LGTM!

Type import refactoring is consistent with the PR-wide migration to direct type exports.

Also applies to: 17-17


110-127: Good implementation for Enter key submission.

Wrapping the input and button in a <form> with on:submit|preventDefault={search} is the correct approach to enable Enter key submission whilst preventing page reload. The button's type="submit" ensures it triggers form submission.

web/src/lib/components/download-dialogs/select-file-path-suffix-dialog.svelte (1)

5-5: LGTM!

The type import refactoring to Movie | Show is appropriate. These types share the common fields needed for the file path suffix selection functionality.

Also applies to: 13-13

web/src/lib/components/torrents/edit-torrent-dialog.svelte (1)

4-4: LGTM!

The type import refactoring correctly uses direct MovieTorrent | RichSeasonTorrent imports. The component accesses torrent.imported, torrent.torrent_id, and torrent.torrent_title which are common to both types.

Also applies to: 14-14

web/package.json (1)

15-15: No issues found with the openapi-typescript CLI flags.

Both --root-types and --root-types-no-schema-prefix are supported in openapi-typescript v7.x and are correctly configured to export root-level type aliases without the "Schema" prefix. The script usage is valid.

web/src/lib/components/torrents/torrent-table.svelte (1)

10-10: LGTM! Clean type refactoring.

The migration from components['schemas']['...'] to direct type imports (MovieTorrent, RichSeasonTorrent, UserRead) improves code readability and maintains type safety. The changes are consistent with the broader refactoring pattern across the codebase.

Also applies to: 25-25, 31-31, 33-33

web/src/lib/components/download-dialogs/download-selected-seasons-dialog.svelte (1)

8-8: LGTM!

Clean type import refactoring consistent with the broader pattern across the codebase.

Also applies to: 19-19

web/src/routes/dashboard/tv/add-show/+page.svelte (1)

15-15: LGTM!

Type refactoring is consistent with the codebase-wide migration to direct type imports.

Also applies to: 20-20, 43-43

web/src/routes/login/+page.svelte (1)

4-5: LGTM!

Clean type refactoring using direct AuthMetadata import.

web/src/lib/components/download-dialogs/download-movie-dialog.svelte (1)

8-8: LGTM!

Consistent type refactoring to use direct Movie import.

Also applies to: 15-15

web/src/routes/dashboard/tv/+page.svelte (1)

11-11: LGTM!

Type refactoring consistent with the codebase pattern.

Also applies to: 17-17

web/src/routes/dashboard/settings/+page.svelte (1)

11-11: LGTM!

Clean type refactoring with explicit UserRead typing throughout.

Also applies to: 13-16

web/src/lib/api/api.d.ts (1)

1721-1763: These type aliases are auto-generated by the --root-types --root-types-no-schema-prefix flags in your openapi script and are correct. No action required.

web/src/lib/utils.ts (1)

7-7: LGTM!

The type import and parameter signature updates correctly align with the broader refactoring to use explicit public type exports (Show, Movie) instead of nested schema paths. This improves readability without changing runtime behaviour.

Also applies to: 113-113

web/src/lib/components/download-dialogs/file-path-suffix-selector.svelte (1)

5-5: LGTM!

The type import and prop signature updates are consistent with the parent component (select-file-path-suffix-dialog.svelte) which passes Movie | Show typed media, and with saveDirectoryPreview in utils.ts which expects the same types.

Also applies to: 13-13

web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.svelte (1)

7-7: LGTM!

The type imports and variable declarations are correctly updated to use explicit public types (PublicEpisodeFile, Season, Show), aligning with the broader type refactoring effort.

Also applies to: 14-16

web/src/routes/dashboard/tv/[showId=uuid]/+page.svelte (1)

10-10: LGTM!

The type imports and variable declarations are correctly updated to use explicit public types (PublicShow, RichShowTorrent, UserRead). The usage of torrents.torrents on line 356 is consistent with RichShowTorrent being a wrapper object containing a torrents array.

Also applies to: 30-32

web/src/lib/components/download-dialogs/download-selected-episodes-dialog.svelte (1)

8-8: LGTM!

The type import and prop signature updates are consistent with the SelectFilePathSuffixDialog component which accepts Movie | Show for its media prop.

Also applies to: 19-19

web/src/lib/components/user-data-table.svelte (1)

13-13: LGTM!

The type import and variable declarations are correctly updated to use the explicit UserRead type, maintaining consistency with the broader type refactoring effort.

Also applies to: 15-18

web/src/lib/components/library-combobox.svelte (1)

11-11: LGTM!

The type imports, prop signature, and type casts are correctly updated to use explicit public types (PublicShow, PublicMovie, LibraryItem). The usage is consistent with parent components in dashboard pages.

Also applies to: 18-18, 24-24, 34-36, 45-45

web/src/routes/dashboard/+page.svelte (1)

13-13: LGTM!

The type annotations and casts for recommendedShows and recommendedMovies are correctly updated to use the explicit MetaDataProviderSearchResult type.

Also applies to: 16-16, 21-21, 25-25

web/src/lib/components/import-media/suggested-media-card.svelte (1)

5-5: LGTM!

The type import refactoring from components['schemas']['MetaDataProviderSearchResult'] to the direct MetaDataProviderSearchResult type alias is clean and consistent with the broader codebase refactor.

Also applies to: 11-11

web/src/routes/dashboard/movies/add-movie/+page.svelte (2)

15-15: LGTM on type refactoring.

The import and variable typing changes are consistent with the broader type alias refactoring across the codebase.

Also applies to: 20-20, 42-42


96-100: LGTM on Enter key submission feature.

The implementation correctly handles submitting the search on Enter:

  • Checks for e.key === 'Enter'
  • Guards against duplicate submissions with !isSearching
  • Calls the same search(searchTerm) function as the button

This matches the PR objective and provides good UX parity with the button.

web/src/routes/dashboard/+layout.svelte (1)

10-10: LGTM!

The type refactoring from components['schemas']['MediaImportSuggestion'] to the direct MediaImportSuggestion type alias is consistent with the codebase-wide refactoring pattern.

Also applies to: 13-14

web/src/routes/dashboard/movies/+page.svelte (1)

9-9: LGTM!

The type import and context variable typing changes are consistent with the broader refactoring to use direct type aliases.

Also applies to: 17-17

web/src/routes/dashboard/movies/[movieId=uuid]/+page.svelte (1)

8-8: LGTM!

The import and variable typing changes correctly use the direct type aliases (PublicMovie, PublicMovieFile, UserRead) instead of the nested components['schemas']['...'] references.

Also applies to: 20-22

web/src/lib/components/import-media/import-candidates-dialog.svelte (1)

6-6: LGTM!

The type refactoring is consistent throughout the component—import, prop type, and function parameter all correctly use MetaDataProviderSearchResult directly.

Also applies to: 19-19, 26-26

web/src/lib/components/add-media-card.svelte (1)

7-7: LGTM!

The type import and prop typing changes correctly use the direct MetaDataProviderSearchResult type alias, consistent with the broader refactoring.

Also applies to: 12-13

web/src/lib/components/recommended-media-carousel.svelte (1)

6-6: LGTM!

The type import and prop typing changes are consistent with the codebase-wide refactoring to use direct type aliases instead of nested schema references.

Also applies to: 14-14

@valentin9 valentin9 force-pushed the custom-search-enter branch from e030121 to 4a3bc06 Compare March 11, 2026 14:58
@valentin9
Copy link
Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/src/lib/components/download-dialogs/download-custom-dialog.svelte (1)

109-127: Preserve the original spacing after wrapping this in a form.

Line 109 still owns the grid ... gap-1.5 layout, but the new <form> at Line 110 is now the only grid item. That means the label, input row, and helper text no longer get the previous gap spacing, so this change also tweaks the dialog layout.

🎯 Suggested diff
-	<div class="grid w-full items-center gap-1.5">
-		<form on:submit|preventDefault={search}>
+	<div class="w-full">
+		<form class="grid items-center gap-1.5" on:submit|preventDefault={search}>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/lib/components/download-dialogs/download-custom-dialog.svelte` around
lines 109 - 127, The form you added became the single child of the outer div
with class "grid w-full items-center gap-1.5", so the Label, Input row and
helper <p> are no longer separate grid items and the gap spacing is lost; fix by
applying the grid and gap classes to the <form> itself (e.g. give the form "grid
w-full items-center gap-1.5") so the Label, the div containing <Input
bind:value={queryOverride} ...> and the helper paragraph are grid children and
spacing is preserved while keeping the existing bindings and submit handler
(search) and Button disabled={isLoading}.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/src/lib/components/download-dialogs/download-custom-dialog.svelte`:
- Around line 109-127: The form you added became the single child of the outer
div with class "grid w-full items-center gap-1.5", so the Label, Input row and
helper <p> are no longer separate grid items and the gap spacing is lost; fix by
applying the grid and gap classes to the <form> itself (e.g. give the form "grid
w-full items-center gap-1.5") so the Label, the div containing <Input
bind:value={queryOverride} ...> and the helper paragraph are grid children and
spacing is preserved while keeping the existing bindings and submit handler
(search) and Button disabled={isLoading}.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d0d8824b-2732-4526-b56a-2e92bb3d76bc

📥 Commits

Reviewing files that changed from the base of the PR and between f525399 and 4a3bc06.

📒 Files selected for processing (1)
  • web/src/lib/components/download-dialogs/download-custom-dialog.svelte

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant