Skip to content

Commit 6320a32

Browse files
fix: pass worker name to syncAssets in dev (#333)
This fix passes the correct worker name to `syncAssets` during `wrangler dev`. This function uses the name to create the backing kv store for a Workers Sites definition, so it's important we get the name right. I also fixed the lint warning introduced in #321, to pass `props.enableLocalPersistence` as a dependency in the `useEffect` call that starts the "local" mode dev server.
1 parent 9c10098 commit 6320a32

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/bright-needles-dance.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
fix: pass worker name to syncAssets in `dev`
6+
7+
This fix passes the correct worker name to `syncAssets` during `wrangler dev`. This function uses the name to create the backing kv store for a Workers Sites definition, so it's important we get the name right.
8+
9+
I also fixed the lint warning introduced in https://github.com/cloudflare/wrangler2/pull/321, to pass `props.enableLocalPersistence` as a dependency in the `useEffect` call that starts the "local" mode dev server.

packages/wrangler/src/dev.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ function useLocalWorker(props: {
324324
bindings.durable_objects?.bindings,
325325
bindings.kv_namespaces,
326326
bindings.vars,
327+
props.enableLocalPersistence,
327328
]);
328329
return { inspectorUrl };
329330
}
@@ -580,7 +581,7 @@ function useWorker(props: {
580581

581582
const assets = await syncAssets(
582583
accountId,
583-
path.basename(bundle.path),
584+
name || path.basename(bundle.path),
584585
assetPaths,
585586
true
586587
); // TODO: cancellable?

0 commit comments

Comments
 (0)