Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK] Fix caching issue with headless UI when custom resolvers are used #5657

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

kien-ngo
Copy link
Contributor

@kien-ngo kien-ngo commented Dec 9, 2024

Problem solved

Short description of the bug fixed or feature added


PR-Codex overview

This PR focuses on fixing caching issues for headless components and improving code coverage in the thirdweb package.

Detailed summary

  • Updated nameResolver and descriptionResolver in NFTName and NFTDescription to use getFunctionId.
  • Enhanced NFTMedia to utilize getFunctionId for mediaResolver.
  • Introduced fetchChainName and fetchTokenName functions for better name resolution.
  • Added tests for fetchChainName, fetchTokenName, and fetchTokenSymbol to ensure proper functionality.
  • Improved getQueryKeys to handle resolvers more effectively in both TokenName and TokenSymbol.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Dec 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 6:35pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 6:35pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 6:35pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 6:35pm

Copy link

changeset-bot bot commented Dec 9, 2024

🦋 Changeset detected

Latest commit: 2fccfc0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
thirdweb Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

graphite-app bot commented Dec 9, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@kien-ngo kien-ngo marked this pull request as ready for review December 9, 2024 15:35
@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Dec 9, 2024
Copy link
Contributor Author

kien-ngo commented Dec 9, 2024


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

github-actions bot commented Dec 9, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 44.93 KB (0%) 899 ms (0%) 3.2 s (+9.87% 🔺) 4.1 s
thirdweb (cjs) 110.71 KB (0%) 2.3 s (0%) 6 s (+1.56% 🔺) 8.2 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 389 ms (+162.55% 🔺) 501 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 109 ms (+163.35% 🔺) 119 ms
thirdweb/react (minimal + tree-shaking) 19.07 KB (0%) 382 ms (0%) 727 ms (+83.94% 🔺) 1.2 s

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 84.09091% with 21 lines in your changes missing coverage. Please review.

Project coverage is 51.52%. Comparing base (d9fb544) to head (2fccfc0).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../thirdweb/src/react/web/ui/prebuilt/Token/name.tsx 86.27% 6 Missing and 1 partial ⚠️
...hirdweb/src/react/web/ui/prebuilt/Token/symbol.tsx 86.27% 6 Missing and 1 partial ⚠️
.../thirdweb/src/react/web/ui/prebuilt/Chain/name.tsx 85.18% 4 Missing ⚠️
...dweb/src/react/web/ui/prebuilt/NFT/description.tsx 0.00% 1 Missing ⚠️
...s/thirdweb/src/react/web/ui/prebuilt/NFT/media.tsx 0.00% 1 Missing ⚠️
...es/thirdweb/src/react/web/ui/prebuilt/NFT/name.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5657      +/-   ##
==========================================
+ Coverage   51.42%   51.52%   +0.09%     
==========================================
  Files        1093     1093              
  Lines       57524    57588      +64     
  Branches     4723     4755      +32     
==========================================
+ Hits        29583    29671      +88     
+ Misses      27225    27200      -25     
- Partials      716      717       +1     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from d9fb544
packages 48.22% <84.09%> (+0.12%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...dweb/src/react/web/ui/prebuilt/NFT/description.tsx 77.35% <0.00%> (ø)
...s/thirdweb/src/react/web/ui/prebuilt/NFT/media.tsx 70.00% <0.00%> (ø)
...es/thirdweb/src/react/web/ui/prebuilt/NFT/name.tsx 77.35% <0.00%> (ø)
.../thirdweb/src/react/web/ui/prebuilt/Chain/name.tsx 89.79% <85.18%> (+21.22%) ⬆️
.../thirdweb/src/react/web/ui/prebuilt/Token/name.tsx 84.50% <86.27%> (+35.61%) ⬆️
...hirdweb/src/react/web/ui/prebuilt/Token/symbol.tsx 84.50% <86.27%> (+33.44%) ⬆️

... and 2 files with indirect coverage changes

Copy link

graphite-app bot commented Dec 11, 2024

Merge activity

…ed (#5657)

## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR addresses caching issues in headless components and enhances code coverage. It introduces the `getFunctionId` utility in various components to improve resolver handling for names and symbols.

### Detailed summary
- Added `getFunctionId` to various components for handling resolvers.
- Updated `NFTName`, `NFTDescription`, and `NFTMedia` to use `getFunctionId` instead of `toString()`.
- Enhanced `ChainIcon`, `TokenIcon`, `ChainName`, and `TokenName` to include resolver handling.
- Introduced `fetchChainName` and `fetchTokenName` for improved name resolution.
- Added tests for `fetchChainName`, `fetchTokenName`, `fetchTokenSymbol`, and their respective query keys.
- Updated `TokenSymbol` to utilize `fetchTokenSymbol` and improved resolver handling.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants