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

[Fix] Handle special case for localhost in development environment in isThirdwebUrl function #3369

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

jnsdls
Copy link
Member

@jnsdls jnsdls commented Jun 18, 2024

fixes: CNCT-1370

TL;DR

This PR updates the isThirdwebUrl function to properly handle the localhost hostname in the development environment.

What changed?

  • Added a check to see if process.env.NODE_ENV is set to development
  • If in development, it checks if the hostname is localhost and treats it as a Thirdweb URL

How to test?

  • Ensure the application runs in both development and production environments
  • In development, verify URLs with localhost return true for isThirdwebUrl
  • In production, verify URLs with localhost return false for isThirdwebUrl

Why make this change?

This change was made to correctly classify localhost as a Thirdweb URL when running in a development environment, allowing for better development workflow and environment parity.



PR-Codex overview

The focus of this PR is to exclude localhost from being considered a thirdweb URL, except in development mode.

Detailed summary

  • Excludes localhost from thirdweb URL check in fetch.ts except in development mode.
  • Adds special handling for localhost in development environment.
  • Improves accuracy of identifying thirdweb URLs.

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

Copy link

vercel bot commented Jun 18, 2024

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

Name Status Preview Comments Updated (UTC)
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2024 0:16am

Copy link

changeset-bot bot commented Jun 18, 2024

🦋 Changeset detected

Latest commit: b808652

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

This PR includes changesets to release 8 packages
Name Type
thirdweb Patch
@thirdweb-dev/sdk Patch
@thirdweb-dev/cli Patch
@thirdweb-dev/react-core Patch
@thirdweb-dev/react Patch
@thirdweb-dev/unity-js-bridge Patch
@thirdweb-dev/wallets Patch
@thirdweb-dev/auth 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 Jun 18, 2024

Your org requires 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.

Copy link
Member Author

jnsdls commented Jun 18, 2024

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

Join @jnsdls and the rest of your teammates on Graphite Graphite

@jnsdls jnsdls marked this pull request as ready for review June 18, 2024 00:03
@jnsdls jnsdls force-pushed the fix-thirdweb-url-local-dev branch from 7d6f4e4 to 59c70ea Compare June 18, 2024 00:04
Copy link

codspeed-hq bot commented Jun 18, 2024

CodSpeed Performance Report

Merging #3369 will improve performances by 10.6%

Comparing fix-thirdweb-url-local-dev (b808652) with main (c42a34f)

Summary

⚡ 1 improvements
✅ 8 untouched benchmarks

Benchmarks breakdown

Benchmark main fix-thirdweb-url-local-dev Change
keccakId 1.4 ms 1.3 ms +10.6%

Copy link
Contributor

github-actions bot commented Jun 18, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 40.6 KB (0%) 813 ms (0%) 506 ms (-11.58% 🔽) 1.4 s
thirdweb (cjs) 90.26 KB (0%) 1.9 s (0%) 1.1 s (-33.41% 🔽) 3 s
thirdweb (minimal + tree-shaking) 4.74 KB (0%) 95 ms (0%) 46 ms (+9.93% 🔺) 141 ms
thirdweb/chains (tree-shaking) 423 B (0%) 10 ms (0%) 16 ms (-85.96% 🔽) 26 ms
thirdweb/react (minimal + tree-shaking) 13.45 KB (0%) 270 ms (0%) 82 ms (+21.83% 🔺) 351 ms

Copy link

codecov bot commented Jun 18, 2024

Codecov Report

Attention: Patch coverage is 41.66667% with 7 lines in your changes missing coverage. Please review.

Project coverage is 62.89%. Comparing base (c42a34f) to head (59c70ea).

Current head 59c70ea differs from pull request most recent head b808652

Please upload reports for the commit b808652 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3369      +/-   ##
==========================================
+ Coverage   62.85%   62.89%   +0.04%     
==========================================
  Files         862      861       -1     
  Lines       63908    63843      -65     
  Branches     3462     3463       +1     
==========================================
- Hits        40168    40156      -12     
+ Misses      23063    23009      -54     
- Partials      677      678       +1     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.60% <ø> (ø) Carriedforward from 9dd1b5a
packages 62.33% <41.66%> (+0.05%) ⬆️

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

Files Coverage Δ
packages/thirdweb/src/utils/fetch.ts 82.01% <41.66%> (-2.99%) ⬇️

... and 1 file with indirect coverage changes

Copy link

graphite-app bot commented Jun 18, 2024

Merge activity

Copy link
Member Author

jnsdls commented Jun 18, 2024

fixes: CNCT-1370

… isThirdwebUrl function (#3369)

### TL;DR

This PR updates the `isThirdwebUrl` function to properly handle the `localhost` hostname in the development environment.

### What changed?

- Added a check to see if `process.env.NODE_ENV` is set to `development`
- If in development, it checks if the hostname is `localhost` and treats it as a Thirdweb URL

### How to test?

- Ensure the application runs in both development and production environments
- In development, verify URLs with `localhost` return `true` for `isThirdwebUrl`
- In production, verify URLs with `localhost` return `false` for `isThirdwebUrl`

### Why make this change?

This change was made to correctly classify `localhost` as a Thirdweb URL when running in a development environment, allowing for better development workflow and environment parity.

---

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to exclude localhost from being considered a thirdweb URL, except in development mode.

### Detailed summary
- Excludes localhost from thirdweb URL check in `fetch.ts` except in development mode.
- Adds special handling for localhost in development environment.
- Improves accuracy of identifying thirdweb URLs.

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

<!-- end pr-codex -->
@jnsdls jnsdls force-pushed the fix-thirdweb-url-local-dev branch from 59c70ea to b808652 Compare June 18, 2024 00:13
Copy link

linear bot commented Jun 18, 2024

@graphite-app graphite-app bot merged commit b808652 into main Jun 18, 2024
20 of 21 checks passed
@graphite-app graphite-app bot deleted the fix-thirdweb-url-local-dev branch June 18, 2024 00:14
@jnsdls jnsdls mentioned this pull request Jun 18, 2024
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.

None yet

2 participants