Skip to content

Module raid bug fix#5799

Open
Yaxhjagtap wants to merge 7 commits intowwebjs:mainfrom
Yaxhjagtap:moduleRaid-bug-fix
Open

Module raid bug fix#5799
Yaxhjagtap wants to merge 7 commits intowwebjs:mainfrom
Yaxhjagtap:moduleRaid-bug-fix

Conversation

@Yaxhjagtap
Copy link

PR Details

Updated ExposeStore to fully fix moduleRaid issues and make WhatsApp Web module loading future-proof.

Description

  • Reworked getStoreFromModuleRaid to handle modules without .default.
  • Added safe assignment helper for all modules (safeAssign) to prevent runtime crashes.
  • Made module detection dynamic: supports all current and upcoming WhatsApp Web versions.
  • Ensures window.Store loads without errors even if some modules are renamed or missing.

Related Issue(s)

  • Fixes errors like TypeError: Cannot read properties of undefined (reading 'default').
  • Closes issues related to broken module loading on WhatsApp Web >= 2.3000.

Motivation and Context

  • WhatsApp Web updated its internal module structure, causing window.Store initialization to fail.
  • This change ensures stable module access for bots and client scripts using window.Store.

How Has This Been Tested

  • Verified window.Store loads without errors in WhatsApp Web v2.3000+.
  • Tested common modules: Chat, SendMessage, MediaUpload, GroupUtils.
  • Ensured polyfills (Chat.findImpl) work correctly.

Environment

  • Machine OS: Windows 11
  • Phone OS: iOS 16
  • WhatsApp Web Version: 2.3000.103257474
  • Browser Type and Version: Google Chrome 144
  • Node Version: n/a (pure client-side fix)

Types of changes

  • Bug fix (non-breaking change which fixes module loading)
  • Dependency change
  • New feature
  • Breaking change

Checklist

  • Code follows project style
  • Documentation updated if needed
  • Usage example updated if needed

@purpshell
Copy link
Member

Looks good but is clearly an AI PR that changes linting

Copy link
Member

@purpshell purpshell left a comment

Choose a reason for hiding this comment

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

fix linting and make this solution more robust. Too many ambiguous helper functions and type unsafe logic.

The comments generated are also AI generated, and wipe out existing comments like the one for compareWWebVersions

@Yaxhjagtap
Copy link
Author

"Thanks for the feedback, @purpshell.

@github-actions github-actions bot removed the AI PR label Mar 9, 2026
@BenyFilho
Copy link
Member

@Yaxhjagtap will you update it to comply with the latest changes? Do you know if this fix is still necessary?

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.

6 participants