-
Notifications
You must be signed in to change notification settings - Fork 74
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
a PR about issue #230 #234
base: main
Are you sure you want to change the base?
Conversation
…) from reaching the load state, because there is a continuous polling request to the server. Therefore, we need to modify the wait state when navigating to the page.
WalkthroughThe pull request introduces modifications to the Changes
Sequence DiagramsequenceDiagram
participant Browser
participant Bridge
participant Page
Browser->>Page: Navigate to URL
Page-->>Browser: Network idle state
Browser->>Bridge: Emit 'domcontentloaded' event
Bridge->>Bridge: Process page load
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (2)src/bridge.ts (2)
This ensures the navigation call completes only after ongoing network requests have settled, which helps avoid timeouts caused by long-running polls on wx.qq.com. Just confirm that this works reliably across different network conditions.
The Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to 9e4df4f in 10 seconds
More details
- Looked at
27
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. src/bridge.ts:269
- Draft comment:
Changing the event from 'load' to 'domcontentloaded' is a reasonable approach given the issue with polling requests preventing the 'load' event from firing. Ensure that all necessary scripts and elements are available at 'domcontentloaded' to avoid potential issues. - Reason this comment was not posted:
Confidence changes required:50%
The PR changes the event from 'load' to 'domcontentloaded' due to polling requests preventing the 'load' event from firing. This change is logical given the context provided in the PR description.
Workflow ID: wflow_DDZAJ0UYhdMdqLKd
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
I am using wechaty on my Mac Pc and I run into the error below.
I have checked the issues and find #230 has the same situation. So I analyzed the start process of this puppet, and I assume the polling request on wx.qq.com prevents the page.goto() from reaching the 'load' state. I tested myself by using puppeteer to open 'wx.qq.com' and the page cannot reach the state of 'load'.
As a result, I tried to modify two parts of the code Bridge.ts about the waiting state of the Puppeteer.Page of opening the url 'wx.qq.com'. And it works.
Important
Fix navigation timeout in
PuppetWeChatBridge
by usingnetworkidle2
and changing load event listener todomcontentloaded
inbridge.ts
.initPage()
inbridge.ts
by settingwaitUntil: 'networkidle2'
inpage.goto()
.load
todomcontentloaded
ininitPage()
to handle polling requests onwx.qq.com
.This description was created by
for 9e4df4f. It will automatically update as commits are pushed.
Summary by CodeRabbit
domcontentloaded
event for better control during page initialization.