fix: fix navbapp app navigation

This commit is contained in:
Ruben Fiszel
2025-09-15 09:32:39 +00:00
parent 54f2db1253
commit 223feede4d
3 changed files with 19 additions and 16 deletions

View File

@@ -12,8 +12,9 @@
import { writable } from 'svelte/store'
import { twMerge } from 'tailwind-merge'
import { page } from '$app/state'
let app: (AppWithLastVersion & { value: any }) | undefined = undefined
let can_write = false
let app: (AppWithLastVersion & { value: any }) | undefined = $state(undefined)
let can_write = $state(false)
async function loadApp() {
app = await AppService.getAppLiteByPath({
@@ -23,13 +24,15 @@
can_write = canWrite(app?.path, app?.extra_perms!, $userStore)
}
$: if ($workspaceStore && page.params.path) {
if (app && page.params.path === app.path) {
console.log('App already loaded')
} else {
loadApp()
$effect(() => {
if ($workspaceStore && page.params.path) {
if (app && page.params.path === app.path) {
console.log('App already loaded')
} else {
loadApp()
}
}
}
})
const breakpoint = writable<EditorBreakpoint>('lg')

View File

@@ -22,11 +22,11 @@
import { page } from '$app/state'
import { urlParamsToObject } from '$lib/utils'
let app: (AppWithLastVersion & { value: any }) | undefined = undefined
let notExists = false
let noPermission = false
let app: (AppWithLastVersion & { value: any }) | undefined = $state(undefined)
let notExists = $state(false)
let noPermission = $state(false)
let jwtError = false
let jwtError = $state(false)
setContext(IS_APP_PUBLIC_CONTEXT_KEY, true)
function isJwt(t: string) {

View File

@@ -23,11 +23,11 @@
import { page } from '$app/state'
import { urlParamsToObject } from '$lib/utils'
let app: (AppWithLastVersion & { value: any }) | undefined = undefined
let notExists = false
let noPermission = false
let app: (AppWithLastVersion & { value: any }) | undefined = $state(undefined)
let notExists = $state(false)
let noPermission = $state(false)
let jwtError = false
let jwtError = $state(false)
setContext(IS_APP_PUBLIC_CONTEXT_KEY, true)
function parseSecret(secret: string): { secret: string; jwt: string } {