setup head subscription

This commit is contained in:
Nikita Galaiko 2023-08-09 16:10:09 +02:00 committed by GitButler
parent ebfe63cd7e
commit f12cf1b9e9
3 changed files with 36 additions and 27 deletions

View File

@ -38,7 +38,7 @@
"@lezer/highlight": "^1.1.6",
"@replit/codemirror-lang-svelte": "^6.0.0",
"@sentry/sveltekit": "^7.58.0",
"@square/svelte-store": "^1.0.17",
"@square/svelte-store": "github:gitbutlerapp/svelte-store#error-state",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.22.3",
"@tauri-apps/api": "^1.4.0",

View File

@ -65,8 +65,8 @@ devDependencies:
specifier: ^7.58.0
version: 7.58.0(@sveltejs/kit@1.22.3)(svelte@4.0.5)
'@square/svelte-store':
specifier: ^1.0.17
version: 1.0.17(svelte@4.0.5)
specifier: github:gitbutlerapp/svelte-store#error-state
version: github.com/gitbutlerapp/svelte-store/4cf861db334188389186a6f41ddfc1ba157b4ffd(svelte@4.0.5)
'@sveltejs/adapter-static':
specifier: ^2.0.2
version: 2.0.2(@sveltejs/kit@1.22.3)
@ -204,10 +204,10 @@ devDependencies:
version: 3.3.2
tauri-plugin-log-api:
specifier: github:tauri-apps/tauri-plugin-log
version: github.com/tauri-apps/tauri-plugin-log/fbbb126e6d7fba7a7e6772d33f99c0fb689f32b6
version: github.com/tauri-apps/tauri-plugin-log/9075595196d5a66f8f3265d2aaf7e2ffeb4cb2ab
tauri-plugin-websocket-api:
specifier: github:tauri-apps/tauri-plugin-websocket
version: github.com/tauri-apps/tauri-plugin-websocket/6c973fc1b8fb307125f52b02a561d51f49dcea71
version: github.com/tauri-apps/tauri-plugin-websocket/4350fdfd0446a9d384b7c00390ce441d69d10a58
tinykeys:
specifier: ^1.4.0
version: 1.4.0
@ -1241,15 +1241,6 @@ packages:
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
dev: true
/@square/svelte-store@1.0.17(svelte@4.0.5):
resolution: {integrity: sha512-DZ6cnPMvxNzSAphgUlrOu6IBntihHq05FOSW7Qm8bA2+x/ZoviAumErFQUvtKiftCOjkQvxbKYXfzBnALiCSyQ==}
peerDependencies:
svelte: ^3.0.0
dependencies:
cookie-storage: 6.1.0
svelte: 4.0.5
dev: true
/@sveltejs/adapter-static@2.0.2(@sveltejs/kit@1.22.3):
resolution: {integrity: sha512-9wYtf6s6ew7DHUHMrt55YpD1FgV7oWql2IGsW5BXquLxqcY9vjrqCFo0TzzDpo+ZPZkW/v77k0eOP6tsAb8HmQ==}
peerDependencies:
@ -5779,16 +5770,28 @@ packages:
engines: {node: '>=12.20'}
dev: true
github.com/tauri-apps/tauri-plugin-log/fbbb126e6d7fba7a7e6772d33f99c0fb689f32b6:
resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-log/tar.gz/fbbb126e6d7fba7a7e6772d33f99c0fb689f32b6}
github.com/gitbutlerapp/svelte-store/4cf861db334188389186a6f41ddfc1ba157b4ffd(svelte@4.0.5):
resolution: {tarball: https://codeload.github.com/gitbutlerapp/svelte-store/tar.gz/4cf861db334188389186a6f41ddfc1ba157b4ffd}
id: github.com/gitbutlerapp/svelte-store/4cf861db334188389186a6f41ddfc1ba157b4ffd
name: '@square/svelte-store'
version: 1.0.17
peerDependencies:
svelte: ^3.0.0
dependencies:
cookie-storage: 6.1.0
svelte: 4.0.5
dev: true
github.com/tauri-apps/tauri-plugin-log/9075595196d5a66f8f3265d2aaf7e2ffeb4cb2ab:
resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-log/tar.gz/9075595196d5a66f8f3265d2aaf7e2ffeb4cb2ab}
name: tauri-plugin-log-api
version: 0.0.0
dependencies:
'@tauri-apps/api': 1.4.0
dev: true
github.com/tauri-apps/tauri-plugin-websocket/6c973fc1b8fb307125f52b02a561d51f49dcea71:
resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-websocket/tar.gz/6c973fc1b8fb307125f52b02a561d51f49dcea71}
github.com/tauri-apps/tauri-plugin-websocket/4350fdfd0446a9d384b7c00390ce441d69d10a58:
resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-websocket/tar.gz/4350fdfd0446a9d384b7c00390ce441d69d10a58}
name: tauri-plugin-websocket-api
version: 0.0.0
dependencies:

View File

@ -33,13 +33,14 @@
const sessionsStore = getSessionStore2(projectId);
const baseBranchStore = getBaseBranchStore(projectId, [fetchStore, headStore]);
const remoteBranchStore = getRemoteBranchStore(projectId, [fetchStore, headStore]);
const vbranchStore = getVirtualBranchStore(projectId, [deltasStore, sessionsStore]);
const vbranchStore = getVirtualBranchStore(projectId, [deltasStore, sessionsStore, headStore]);
const branchesWithContent = getWithContentStore(projectId, sessionsStore, vbranchStore);
const fetchUnsubscribe = fetchStore.subscribeStream();
const gitHeadUnsubscribe = headStore.subscribeStream();
const sessionsUnsubscribe = sessionsStore.subscribeStream();
const baseBranchState = baseBranchStore.state;
const branchesState = branchesWithContent.state;
const baseBranchesState = baseBranchStore.state;
const remoteBranchesState = remoteBranchStore.state;
@ -78,7 +79,7 @@
});
</script>
{#await baseBranchStore.load() then}
{#if !$baseBranchState.isError}
{#if $baseBranchStore}
<div class="flex w-full max-w-full" role="group" on:dragover|preventDefault>
<Tray
@ -220,10 +221,15 @@
</div>
</div>
{/if}
{:catch error}
{#if error.code === Code.InvalidHead}
<p>go back to to gitbutler/integration to continue</p>
{:else}
<p>{error.message}</p>
{/if}
{/await}
{:else}
<div class="m-auto text-light-700 dark:text-dark-100">
{#if $baseBranchState.error.code === Code.InvalidHead}
<div class="rounded-md bg-light-400 p-4 dark:bg-dark-700">
<h2 class="text-lg font-semibold">Invalid Head</h2>
<p>{$baseBranchState.error.message}</p>
</div>
{:else}
<p>{$baseBranchState.error.message}</p>
{/if}
</div>
{/if}