Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/frontend/src/lib/components/hosting/HostingSettings.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { fromNullable, nonNullish } from '@dfinity/utils';
import { onMount } from 'svelte';
import { fromNullable, isNullish, nonNullish } from '@dfinity/utils';
import { onMount, untrack } from 'svelte';

Check warning on line 3 in src/frontend/src/lib/components/hosting/HostingSettings.svelte

View workflow job for this annotation

GitHub Actions / lint

'onMount' is defined but never used. Allowed unused vars must match /^_/u
import { fade } from 'svelte/transition';
import type { SatelliteDid } from '$declarations';
import HostingSwitchMemory from '$lib/components/hosting/HostingSwitchMemory.svelte';
Expand All @@ -9,6 +9,7 @@
import { authIdentity } from '$lib/derived/auth.derived';
import { getRuleDapp } from '$lib/services/satellite/collection.services';
import { i18n } from '$lib/stores/app/i18n.store';
import { versionStore } from '$lib/stores/version.store';
import type { Satellite } from '$lib/types/satellite';

interface Props {
Expand All @@ -26,15 +27,22 @@
let memory = $derived(fromNullable(rule?.memory ?? []));

const loadRule = async () => {
if (isNullish($authIdentity) || $versionStore?.satellites[satelliteId.toText()] === undefined) {
return;
}

const result = await getRuleDapp({ satelliteId, identity: $authIdentity });
rule = result?.rule;
supportSettings = result?.result === 'success';

loading = false;
};

onMount(() => {
loadRule();
$effect(() => {
$authIdentity;
$versionStore;

untrack(loadRule);
});
</script>

Expand Down