Use reactive variables for page data

We need to use reactive variables for page data, otherwise they
do not trigger recalculation on navigation.
This commit is contained in:
Mattias Granlund 2023-11-20 10:52:30 +01:00
parent 7f633e59f5
commit a364fc9341
6 changed files with 22 additions and 14 deletions

View File

@ -3,7 +3,9 @@
import BaseBranch from './BaseBranch.svelte';
export let data: PageData;
let { projectId, branchController, baseBranchService } = data;
$: projectId = data.projectId;
$: branchController = data.branchController;
$: baseBranchService = data.baseBranchService;
$: base$ = baseBranchService.base$;
$: error$ = baseBranchService.error$;
</script>

View File

@ -15,7 +15,6 @@
import type { Update } from '../../updater';
import DomainButton from './DomainButton.svelte';
import IconBranch from '$lib/icons/IconBranch.svelte';
import IconSettings from '$lib/icons/IconSettings.svelte';
import type { PrService } from '$lib/github/pullrequest';
import type { BaseBranchService, VirtualBranchService } from '$lib/vbranches/branchStoresCache';
import type { RemoteBranchService } from '$lib/stores/remoteBranches';

View File

@ -5,8 +5,9 @@
import { map } from 'rxjs';
export let data: PageData;
let { branchController, prService } = data;
$: branchController = data.branchController;
$: prService = data.prService;
$: pr = prService.prs$?.pipe(
map((prs) => prs.find((b) => b.number.toString() == $page.params.number))
);

View File

@ -4,7 +4,9 @@
import RemoteBranchPreview from './RemoteBranchPreview.svelte';
export let data: PageData;
let { projectId, branchController, remoteBranchService } = data;
$: projectId = data.projectId;
$: branchController = data.branchController;
$: remoteBranchService = data.remoteBranchService;
$: branches$ = remoteBranchService.branches$;
$: error$ = remoteBranchService.branchesError$;

View File

@ -11,7 +11,12 @@
import type { Key, Project } from '$lib/backend/projects';
export let data: PageData;
const { projectService, cloud, user$, userService, project$ } = data;
$: projectService = data.projectService;
$: project$ = data.project$;
$: userService = data.userService;
$: user$ = data.user$;
$: cloud = data.cloud;
let deleteConfirmationModal: Modal;
let isDeleting = false;

View File

@ -4,16 +4,15 @@
import BranchLane from '../../components/BranchLane.svelte';
export let data: PageData;
let {
projectId,
branchController,
githubContext$,
cloud,
baseBranchService,
vbranchService,
user$
} = data;
$: projectId = data.projectId;
$: user$ = data.user$;
$: githubContext$ = data.githubContext$;
$: cloud = data.cloud;
$: branchController = data.branchController;
$: vbranchService = data.vbranchService;
$: baseBranchService = data.baseBranchService;
$: baseBranch$ = baseBranchService.base$;
$: branches$ = vbranchService.branches$;