Skip to content

Injected.ts continuously polls setupReactiveFeatures every second #3251

@sreeja2007

Description

@sreeja2007

Search before asking

  • I had searched in the issues and found no similar issues.

Operating System

  • macOS
  • Windows
  • Linux

Operating System Version

No response

It happens on the web browser too?

Yes, it happens on the web browser too

Rocket.Chat Desktop App Version

3.8.9

Rocket.Chat Server Version

4.8.2

Describe the bug

Description

In Injected.ts, the function setupReactiveFeatures is executed using:

setInterval(setupReactiveFeatures, 1000);

This causes the function to run every second indefinitely.

Although setupFlags prevents duplicate feature setup, the interval continues to execute even after all features have already been initialized.

Problem

This results in unnecessary CPU usage because the function continues running even when no additional modules need to be initialized.

Expected Behavior

Once all reactive features are successfully initialized, the interval should stop running.

Possible Solution

Stop the interval once all setup flags are true, or replace the polling mechanism with a more event-driven approach.

How to Reproduce

Steps to Reproduce

  1. Start the Rocket.Chat Desktop application in development mode.
  2. Open the developer console.
  3. Add a temporary log inside the setupReactiveFeatures function in Injected.ts.
  4. Observe the console output.

Describe your Expected behavior

No response

Anything else

No response

Are you willing to submit a code contribution?

  • Yes, I am willing to submit a Pull Request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions