Skip to content

Useless function?? #1

Closed
Closed

Description

@Benjamincf0

It seems inside the utils file, that both WaitFor and WaitForElement are very similar and attempt to do the same thing? This seems redundant. one of them should be removed

Activity

  1. Benjamincf0 commented on Mar 17, 2026

    @Benjamincf0
    OwnerAuthor

    /oc explain this issue and how to resolve it

  2. opencode-agent commented on Mar 17, 2026

    @opencode-agent
    Contributor

    Analysis

    The issue is valid. Both functions do the same thing:

    Aspect waitFor waitForElement
    Lines 3-13 15-35
    API Callback-based Promise-based
    Initial check No Yes (sync query first)
    Observes document.body document
    Usage 5 times (strategy.ts) 1 time (uimanager.ts)

    Both use MutationObserver to wait for DOM elements matching a selector, then disconnect and return the element.

    Resolution

    The functions are redundant. Recommend keeping waitFor (used more frequently) and consolidating waitForElement into it:

    1. Replace the single usage in uimanager.ts to use waitFor with a callback
    2. Remove waitForElement from utils.ts

    This simplifies maintenance. Want me to make these changes?

    New%20session%20-%202026-03-17T05%3A33%3A03.594Z
    opencode session  |  github run

  3. Benjamincf0 commented on Mar 17, 2026

    @Benjamincf0
    OwnerAuthor

    /oc ok sure do that and then make a pr

  4. opencode-agent commented on Mar 17, 2026

    @opencode-agent
    Contributor

    Created PR #2

    New%20session%20-%202026-03-17T05%3A37%3A20.817Z
    opencode session  |  github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions