Skip to content

perf+bug: setTimeout callback misuse causes immediate execution in PhraseMaker/Timbre #6132

@Rohit-rk07

Description

@Rohit-rk07

Summary

Multiple setTimeout calls pass the result of a function call instead of a callback function.

Pattern in code:

  • setTimeout(this.someMethod(...), 500)

This executes the method immediately on the current tick, then passes its return value to setTimeout. That defeats the intended defer behavior and can add avoidable synchronous work/jank while editing blocks.

Affected locations

  • js/widgets/phrasemaker.js:1135
  • js/widgets/phrasemaker.js:1140
  • js/widgets/phrasemaker.js:1208
  • js/widgets/phrasemaker.js:3159
  • js/widgets/phrasemaker.js:3161
  • js/widgets/timbre.js:1041
  • js/widgets/timbre.js:1044
  • js/widgets/timbre.js:1047
  • js/widgets/timbre.js:1049
  • js/widgets/timbre.js:1051

Expected behavior

Deferred code should be wrapped in a callback:

  • setTimeout(() => this.someMethod(...), 500)

Why this matters

  • Avoids unnecessary synchronous block graph/layout work.
  • Restores intended timing and reduces potential UI stutter under rapid interactions.

Suggested fix

Replace each affected call with callback-wrapped versions (or direct async flow where delay is not needed).

Optional follow-up

Add a lint rule/check to catch setTimeout(<call expression>, ...) misuse in widgets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions