|
@@ -1,5 +1,5 @@
|
|
|
-import { createEffect, createMemo, createRoot, onCleanup } from "solid-js"
|
|
|
|
|
-import { createStore, produce } from "solid-js/store"
|
|
|
|
|
|
|
+import { batch, createEffect, createMemo, createRoot, onCleanup } from "solid-js"
|
|
|
|
|
+import { createStore, produce, reconcile } from "solid-js/store"
|
|
|
import { createSimpleContext } from "@opencode-ai/ui/context"
|
|
import { createSimpleContext } from "@opencode-ai/ui/context"
|
|
|
import type { FileContent, FileNode } from "@opencode-ai/sdk/v2"
|
|
import type { FileContent, FileNode } from "@opencode-ai/sdk/v2"
|
|
|
import { showToast } from "@opencode-ai/ui/toast"
|
|
import { showToast } from "@opencode-ai/ui/toast"
|
|
@@ -8,7 +8,6 @@ import { getFilename } from "@opencode-ai/util/path"
|
|
|
import { useSDK } from "./sdk"
|
|
import { useSDK } from "./sdk"
|
|
|
import { useSync } from "./sync"
|
|
import { useSync } from "./sync"
|
|
|
import { useLanguage } from "@/context/language"
|
|
import { useLanguage } from "@/context/language"
|
|
|
-import { decode64 } from "@/utils/base64"
|
|
|
|
|
import { Persist, persisted } from "@/utils/persist"
|
|
import { Persist, persisted } from "@/utils/persist"
|
|
|
|
|
|
|
|
export type FileSelection = {
|
|
export type FileSelection = {
|
|
@@ -276,12 +275,10 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
|
|
|
const params = useParams()
|
|
const params = useParams()
|
|
|
const language = useLanguage()
|
|
const language = useLanguage()
|
|
|
|
|
|
|
|
- const directory = createMemo(() => decode64(params.dir) ?? sdk.directory)
|
|
|
|
|
-
|
|
|
|
|
- const scope = createMemo(() => directory())
|
|
|
|
|
|
|
+ const scope = createMemo(() => sdk.directory)
|
|
|
|
|
|
|
|
function normalize(input: string) {
|
|
function normalize(input: string) {
|
|
|
- const root = directory()
|
|
|
|
|
|
|
+ const root = scope()
|
|
|
const prefix = root.endsWith("/") ? root : root + "/"
|
|
const prefix = root.endsWith("/") ? root : root + "/"
|
|
|
|
|
|
|
|
let path = unquoteGitPath(stripQueryAndHash(stripFileProtocol(input)))
|
|
let path = unquoteGitPath(stripQueryAndHash(stripFileProtocol(input)))
|
|
@@ -372,9 +369,13 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
|
|
|
inflight.clear()
|
|
inflight.clear()
|
|
|
treeInflight.clear()
|
|
treeInflight.clear()
|
|
|
contentLru.clear()
|
|
contentLru.clear()
|
|
|
- setStore("file", {})
|
|
|
|
|
- setTree("node", {})
|
|
|
|
|
- setTree("dir", { "": { expanded: true } })
|
|
|
|
|
|
|
+
|
|
|
|
|
+ batch(() => {
|
|
|
|
|
+ setStore("file", reconcile({}))
|
|
|
|
|
+ setTree("node", reconcile({}))
|
|
|
|
|
+ setTree("dir", reconcile({}))
|
|
|
|
|
+ setTree("dir", "", { expanded: true })
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const viewCache = new Map<string, ViewCacheEntry>()
|
|
const viewCache = new Map<string, ViewCacheEntry>()
|
|
@@ -415,7 +416,7 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
|
|
|
return entry.value
|
|
return entry.value
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const view = createMemo(() => loadView(directory(), params.id))
|
|
|
|
|
|
|
+ const view = createMemo(() => loadView(scope(), params.id))
|
|
|
|
|
|
|
|
function ensure(path: string) {
|
|
function ensure(path: string) {
|
|
|
if (!path) return
|
|
if (!path) return
|