Skip to content

fix: include projectId in API requests when value is empty string - #5631

Merged
svenvoskamp merged 2 commits into
chore/khizr-fixesfrom
chore/khizr-fixes-REOWN-4529
Apr 13, 2026
Merged

fix: include projectId in API requests when value is empty string#5631
svenvoskamp merged 2 commits into
chore/khizr-fixesfrom
chore/khizr-fixes-REOWN-4529

Conversation

@Khizr97

@Khizr97 Khizr97 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes projectId being silently dropped from api.web3modal.org requests (REOWN-4529).

Technical Report

Problem

API requests to getAnalyticsConfig and getWallets were missing the projectId query parameter, causing useAppKitWallet to not work with @reown/appkit-wallet-button.

Root Cause Analysis

FetchUtil.createUrl() used if (value) to filter query params before appending to the URL. This check filters out all falsy values — including empty strings. OptionsController defaults projectId to '' (empty string), so any API call made before OptionsController.setProjectId() runs would have projectId filtered out.

The _getSdkProperties() method reads OptionsController.state.projectId and returns it as a param. When it's still the default empty string, if (value) evaluates to false and the param is silently dropped.

Approach & Reasoning

Changed to explicit null/undefined check — if (value !== undefined && value !== null). This preserves the intended behavior of filtering out undefined params while allowing empty strings through.

Considered alternatives:

  • Fixing the default value of projectId — would only fix projectId, not other params with the same issue
  • Adding a guard in _getSdkProperties() — would be a point fix, not addressing the general FetchUtil problem
  • The chosen approach fixes the root cause for all params at once

Note on empty string params: This change means params like exclude='' will now be sent as ?exclude= instead of being omitted. Reown's own API should treat empty string params the same as absent params (standard REST behavior). Low risk.

Verification

  • 10/10 FetchUtil tests pass
  • 52/52 ApiController tests pass (1 skipped — pre-existing)
  • Type check clean

Test plan

  • Verify getAnalyticsConfig request includes projectId param
  • Verify getWallets request includes projectId param
  • Verify useAppKitWallet works with @reown/appkit-wallet-button

🤖 Generated with Claude Code

FetchUtil.createUrl() used `if (value)` to filter query params, which
also filtered out empty strings. This caused projectId to be dropped
from API requests when OptionsController hadn't been initialized yet
(projectId defaults to empty string). Changed to explicit
`value !== undefined && value !== null` check.

Closes REOWN-4529

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
appkit-demo Ready Ready Preview, Comment Apr 9, 2026 1:15pm
appkit-gallery Ready Ready Preview, Comment Apr 9, 2026 1:15pm
appkit-headless-sample-app Ready Ready Preview, Comment Apr 9, 2026 1:15pm
appkit-laboratory Ready Ready Preview, Comment Apr 9, 2026 1:15pm
9 Skipped Deployments
Project Deployment Actions Updated (UTC)
appkit-basic-example Ignored Ignored Apr 9, 2026 1:15pm
appkit-basic-sign-client-example Ignored Ignored Apr 9, 2026 1:15pm
appkit-basic-up-example Ignored Ignored Apr 9, 2026 1:15pm
appkit-ethers5-bera Ignored Ignored Apr 9, 2026 1:15pm
appkit-nansen-demo Ignored Ignored Apr 9, 2026 1:15pm
appkit-wagmi-cdn-example Ignored Ignored Apr 9, 2026 1:15pm
ethereum-provider-wagmi-example Ignored Ignored Apr 9, 2026 1:15pm
next-wagmi-solana-bitcoin-example Ignored Ignored Apr 9, 2026 1:15pm
vue-wagmi-example Ignored Ignored Apr 9, 2026 1:15pm

Request Review

@linear

linear Bot commented Apr 9, 2026

Copy link
Copy Markdown

@changeset-bot

changeset-bot Bot commented Apr 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 07814e9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Khizr97

Khizr97 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CTA Document and I hereby sign the CTA

@svenvoskamp
svenvoskamp merged commit 2f3408b into chore/khizr-fixes Apr 13, 2026
17 of 18 checks passed
@svenvoskamp
svenvoskamp deleted the chore/khizr-fixes-REOWN-4529 branch April 13, 2026 16:29
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants