fix: open settings deep links on client-side navigation and open Add Terminal settings directly (#27552)
This commit is contained in:
2 files changed
+8
-3
No files matched your search
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
import { goto } from '$app/navigation';
|
|
||||||
|
|
||||||
import { settings, showSettings, terminalServers, selectedTerminalId, user } from '$lib/stores';
|
import { settings, showSettings, terminalServers, selectedTerminalId, user } from '$lib/stores';
|
||||||
import { getToolServersData } from '$lib/apis';
|
import { getToolServersData } from '$lib/apis';
|
||||||
@@ -193,7 +192,7 @@
|
|||||||
class="p-0.5 rounded-md text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 transition"
|
class="p-0.5 rounded-md text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 transition"
|
||||||
on:click|stopPropagation={() => {
|
on:click|stopPropagation={() => {
|
||||||
show = false;
|
show = false;
|
||||||
goto('/admin/settings/integrations');
|
showSettings.set('admin:integrations');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
@@ -199,6 +199,9 @@
|
|||||||
const openSettingsFromUrl = async () => {
|
const openSettingsFromUrl = async () => {
|
||||||
const requestedSettings = $page.url.searchParams.get('settings');
|
const requestedSettings = $page.url.searchParams.get('settings');
|
||||||
if (!requestedSettings) {
|
if (!requestedSettings) {
|
||||||
|
// Param handled and stripped; allow the same deep link to be
|
||||||
|
// handled again later in this session.
|
||||||
|
handledSettingsUrl = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +385,10 @@
|
|||||||
loaded = true;
|
loaded = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$: if (loaded) {
|
// `$page.url` must be referenced here: `$:` only tracks variables used in
|
||||||
|
// the statement itself, and reads inside openSettingsFromUrl don't count —
|
||||||
|
// without it, client-side navigations to `?settings=...` are never handled.
|
||||||
|
$: if (loaded && $page.url) {
|
||||||
void openSettingsFromUrl();
|
void openSettingsFromUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user