use-ink / contracts-ui

Web application for deploying wasm smart contracts on Substrate chains that include the FRAME contracts pallet
https://contracts-ui.substrate.io/
GNU General Public License v3.0
61 stars 45 forks source link

fix: hashlookup page rework #438

Closed peetzweg closed 1 year ago

peetzweg commented 1 year ago

Described initially in #402 .

Consist majorly of two related bug fixes.

  1. preventing insertion of duplicate codeBundles into the dexie db. https://github.com/paritytech/contracts-ui/blob/42fd9fab918399852b4033ba63c389a3306bb679/src/ui/hooks/useNewContract.ts#L29-L33 instead of https://github.com/paritytech/contracts-ui/blob/262140ed9982f5b756b3e9f661debb3a2a9c39b8/src/ui/hooks/useNewContract.ts#L25

  2. fetching all codeBundles available and not only a single page https://github.com/paritytech/contracts-ui/blob/42fd9fab918399852b4033ba63c389a3306bb679/src/ui/components/instantiate/AvailableCodeBundles.tsx#L58 instead of https://github.com/paritytech/contracts-ui/blob/262140ed9982f5b756b3e9f661debb3a2a9c39b8/src/ui/components/instantiate/AvailableCodeBundles.tsx#L56

Demo with PAGE_SIZE=1

demo

netlify[bot] commented 1 year ago

Deploy Preview for contracts-ui ready!

Name Link
Latest commit f795726af9d3dbb999cf9bd656b976aef73fa097
Latest deploy log https://app.netlify.com/sites/contracts-ui/deploys/641892dd69a81b0008c9f966
Deploy Preview https://deploy-preview-438--contracts-ui.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

peetzweg commented 1 year ago

This is not proper pagination as all datasets are fetched at once from the local db but I think this is fine for now as can expect the data of codeBundles to be quite limited. No one would probably have over 100+ codeBundles in their indexedDb.