Skip to content

[Bug] Auto-sync failed & Push button missing on LeetCode China (leetcode.cn) #81

@Philip-Cao-9527

Description

@Philip-Cao-9527

Describe the bug
The LeetHub-3.0 extension is completely non-functional on the LeetCode China site (leetcode.cn).

  1. Auto-sync fails: When I click the "Submit" button to submit a solution, the code is not automatically pushed to GitHub, even after a successful submission.
  2. Missing UI: The manual "Push" icon/button does not appear in the code editor toolbar (to the left of the "Format Code" button).

This issue is specific to leetcode.cn; the extension works perfectly on leetcode.com.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any problem page on 'https://leetcode.cn/' (e.g., https://leetcode.cn/problems/two-sum/).
  2. Check UI: Observe that the LeetHub "Push" button is missing from the toolbar (editor action bar).
  3. Check Functionality: Write a solution and click the standard "Submit" (提交) button on the page.
  4. See error: After the solution is accepted by LeetCode, check the GitHub repository. The new submission is not uploaded.

Expected behavior

  1. The extension should automatically sync the code to GitHub upon a successful submission on leetcode.cn.
  2. The manual "Push" button should be visible in the toolbar.

Screenshots

Image

Description: On leetcode.com, the LeetHub "Push" button is clearly visible in the toolbar and the integration works as expected.

Image

Description: On leetcode.cn, the "Push" button is completely missing from the toolbar. No LeetHub UI elements are loaded, and auto-sync fails.

Environment

  • OS: Windows
  • Browser:
    • Microsoft Edge: Version 143.0.3650.139 (Official Build) (64-bit)
    • Google Chrome: Version 143.0.7499.193 (Official Build) (64-bit)
  • Extension Version: 0.0.15 (LeetHub-3.0)

Additional context

  • Troubleshooting:
    • Disabled all other extensions to rule out conflicts.
    • Confirmed that the exact same setup works on leetcode.com.
    • The README mentions "old layout" or "dynamic layout", but leetcode.cn does not seem to offer an option to switch layouts, and the current default layout on CN is not recognized by the extension.
  • Possible Technical Cause:
    • It seems the extension fails to attach event listeners to the "Submit" button or find the correct DOM elements on the Chinese site.
    • In src/js/leetcode.js, the code uses specific selectors (e.g., [data-cy="submit-code-btn"] or [data-e2e-locator="console-submit-button"]) to trigger the loader. If leetcode.cn has updated its DOM structure or class names, these selectors will fail, preventing both the auto-sync trigger and the injection of the manual Push button.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions