-
-
Notifications
You must be signed in to change notification settings - Fork 334
feat(translation-hub): persist selected translation providers in tran… #1186
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@read-frog/extension": minor | ||
| --- | ||
|
|
||
| feat(translation-hub): persist selected translation providers in translation center dropdown |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,6 +84,10 @@ export const pageTranslationShortcutSchema = z.string().superRefine((shortcut, c | |
| } | ||
| }) | ||
|
|
||
| export const translationHubConfigSchema = z.object({ | ||
| selectedIds: z.array(z.string()), | ||
| }) | ||
|
|
||
| export const translateConfigSchema = z.object({ | ||
| providerId: z.string().nonempty(), | ||
| mode: translationModeSchema, | ||
|
|
@@ -106,6 +110,7 @@ export const translateConfigSchema = z.object({ | |
| requestQueueConfig: requestQueueConfigSchema, | ||
| batchQueueConfig: batchQueueConfigSchema, | ||
| translationNodeStyle: translationNodeStyleConfigSchema, | ||
| translationHubConfig: translationHubConfigSchema, | ||
|
Comment on lines
111
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Adding a required Useful? React with 👍 / 👎. |
||
| }) | ||
|
|
||
| export type RequestQueueConfig = z.infer<typeof requestQueueConfigSchema> | ||
|
|
||
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.
Once
setSelectedIdsruns,selectedProviderIdsOverrideAtomstays non-null for the rest of the page lifetime, so this getter never re-appliesfilterEnabledProvidersConfigor re-reads the persistedtranslate.translationHubConfig.selectedIds. In the common Vivaldi-panel workflow where the hub stays mounted, disabling a provider or importing synced config from popup/options leaves the panel on stale ids;selectedProvidersAtomthen resolves those ids straight fromprovidersConfig, so a provider disabled elsewhere can still be shown and used until the page reloads.Useful? React with 👍 / 👎.