mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-09 22:25:02 +03:00
refactor(app): drop the unused file tree scope option (#61846)
This commit is contained in:
committed by
GitHub
Unverified
parent
fb26077935
commit
9b7ffd32b3
@@ -62,7 +62,6 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
|
||||
const waiters = new Map<string, PromiseWithResolvers<void>>()
|
||||
|
||||
const tree = createFileTreeStore({
|
||||
scope,
|
||||
normalizeDir: path.normalizeDir,
|
||||
list: (dir) =>
|
||||
serverSDK.api.file.list({ path: dir, location: { directory: scope() } }).then((x) =>
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
} from "./tree-machine"
|
||||
|
||||
type TreeStoreOptions = {
|
||||
scope: () => string
|
||||
normalizeDir: (input: string) => string
|
||||
list: (input: string) => Promise<FileNode[]>
|
||||
onError: (message: string) => void
|
||||
|
||||
@@ -9,7 +9,7 @@ const file = (path: string): FileNode => ({ path, type: "file", name: path, abso
|
||||
|
||||
type Call = { dir: string; resolve: (nodes: FileNode[]) => void; reject: (error: Error) => void }
|
||||
|
||||
function setup(scope = () => "/repo") {
|
||||
function setup() {
|
||||
const calls: Call[] = []
|
||||
const errors: string[] = []
|
||||
|
||||
@@ -18,7 +18,6 @@ function setup(scope = () => "/repo") {
|
||||
errors,
|
||||
dispose,
|
||||
store: createFileTreeStore({
|
||||
scope,
|
||||
normalizeDir: (input) => input,
|
||||
list: (dir) => new Promise((resolve, reject) => calls.push({ dir, resolve, reject })),
|
||||
onError: (message) => errors.push(message),
|
||||
@@ -55,10 +54,8 @@ describe("file tree store", () => {
|
||||
})
|
||||
|
||||
test("a listing from the previous workspace neither reports nor releases the new workspace's listing", async () => {
|
||||
const workspace = { directory: "/a" }
|
||||
const tree = setup(() => workspace.directory)
|
||||
const tree = setup()
|
||||
void tree.store.listDir("")
|
||||
workspace.directory = "/b"
|
||||
tree.store.reset()
|
||||
void tree.store.listDir("")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user