Skip to content

Commit

Permalink
fix: pass worker name to syncAssets in dev
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
threepointone committed Jan 28, 2022
1 parent 9c10098 commit 95e279b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .changeset/bright-needles-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"wrangler": patch
---

fix: pass worker name to syncAssets in `dev`

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 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.
3 changes: 2 additions & 1 deletion packages/wrangler/src/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ function useLocalWorker(props: {
bindings.durable_objects?.bindings,
bindings.kv_namespaces,
bindings.vars,
props.enableLocalPersistence,
]);
return { inspectorUrl };
}
Expand Down Expand Up @@ -580,7 +581,7 @@ function useWorker(props: {

const assets = await syncAssets(
accountId,
path.basename(bundle.path),
name || path.basename(bundle.path),
assetPaths,
true
); // TODO: cancellable?
Expand Down

0 comments on commit 95e279b

Please sign in to comment.