Skip to content

Fix WhatsApp phone parsing crash - #29004

Merged
raycastbot merged 2 commits into
raycast:mainfrom
mralonsocorona:fix/whatsapp-parse-phone-undefined
Jun 25, 2026
Merged

raycastbot merged 2 commits into
raycast:mainfrom
mralonsocorona:fix/whatsapp-parse-phone-undefined

Conversation

@mralonsocorona

Copy link
Copy Markdown
Contributor

Summary

Fixes a crash in the WhatsApp extension phone parsing helper when the default country preference is missing.

The parseUserPhone helper previously called .trim() directly on the configured defaultCountry. When that preference is unavailable, the Open Chat command can crash while parsing search input.

Changes

  • Allow parseUserPhone to safely handle missing input.
  • Guard the defaultCountry preference before trimming it.
  • Keep existing behavior for international numbers and configured default countries.
  • Add a changelog entry using {PR_MERGE_DATE}.

Validation

  • npm run lint
  • npm run build

Fixes #28921
Fixes #28918

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: whatsapp Issues related to the whatsapp extension AI Extension platform: macOS platform: Windows labels Jun 24, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @vimtor @xmok @p-gurbani you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="fix/whatsapp-parse-phone-undefined"
FORK_URL="https://github.com/mralonsocorona/extensions.git"
EXTENSION_NAME="whatsapp"
REPO_NAME="extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Guards parseUserPhone against a crash when input is undefined or defaultCountry is missing from preferences, fixing the Open Chat command crash reported in #28918/#28921.

  • parsePhone.ts: input is now optional; both input?.trim() ?? "" and defaultCountry?.trim() use optional chaining so a missing preference no longer throws.
  • CHANGELOG.md: Adds a Fix entry, though the date placeholder should be {PR_MERGE_DATE} rather than a hardcoded date.

Confidence Score: 5/5

Safe to merge; the logic change is minimal and directly addresses the crash without altering any happy-path behavior.

The fix is a small, targeted defensive change — optional chaining on two values that were previously assumed non-null. No existing behavior is altered for users who have the preference set, and the empty-string fallback for undefined input produces a valid { isValid: false } result from the phone library rather than throwing.

CHANGELOG.md needs the date placeholder corrected before merge.

Important Files Changed

Filename Overview
extensions/whatsapp/src/utils/parsePhone.ts Makes input optional and guards both input and defaultCountry with optional chaining; correctly fixes the crash reported in the linked issues.
extensions/whatsapp/CHANGELOG.md New Fix entry uses a hardcoded date (2026-06-25) instead of the required {PR_MERGE_DATE} placeholder.

Reviews (2): Last reviewed commit: "Update CHANGELOG.md" | Re-trigger Greptile

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved 🔥

@pernielsentikaer pernielsentikaer self-assigned this Jun 25, 2026
@raycastbot
raycastbot merged commit ff82491 into raycast:main Jun 25, 2026
2 of 3 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Published to the Raycast Store:
https://raycast.com/vimtor/whatsapp

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@mralonsocorona).

Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag.

almatkai pushed a commit to almatkai/raymes-extensions that referenced this pull request Jul 13, 2026
* fix(whatsapp): guard phone parsing preferences

* Update CHANGELOG.md

---------

Co-authored-by: raycastbot <bot@raycast.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Extension extension fix / improvement Label for PRs with extension's fix improvements extension: whatsapp Issues related to the whatsapp extension platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WhatsApp] [WhatsApp] Can't load chats

3 participants