Skip to content

Fix getStores endpointURL under production minification - #419

Open
sirdeggen wants to merge 1 commit into
mainfrom
fix/storage-endpoint-url-minify
Open

Fix getStores endpointURL under production minification#419
sirdeggen wants to merge 1 commit into
mainfrom
fix/storage-endpoint-url-minify

Conversation

@sirdeggen

Copy link
Copy Markdown
Contributor

Summary

  • WalletStorageManager.getStoreEndpointURL used constructor.name === 'StorageClient', which fails after Vite/esbuild/webpack minify renames the class.
  • Remote backups still synced (walks _backups), but clients that match stores by URL (e.g. bsv-desktop Make Primary) saw endpointURL: undefined and failed with "No storage provider matching …".
  • Resolve the URL by duck-typing provider.endpointUrl instead.

Changes

  • WalletStorageManager.getStoreEndpointURL: duck-type endpointUrl; document why constructor.name is unsafe
  • Unit tests for normal, minified class name, local/empty, and getStores() exposure
  • CHANGELOG note under unreleased

Test plan

  • pnpm exec jest --runTestsByPath test/storage/getStoreEndpointURL.test.ts (5 passed)
  • After publish/link into bsv-desktop: add remote backup, Sync works, Make Primary on https://store-us-1.bsvb.tech succeeds

Production minifiers rename StorageClient, so getStores().endpointURL was
always undefined for remote providers while backup sync still worked.
Duck-type provider.endpointUrl instead.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant