LearnNewsExamplesServices
Frontmatter
id7101
titleRefactor: Remove redundant createBindings() call from onConstructed
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 23, 2025, 2:13 PM
updatedAtJul 23, 2025, 2:14 PM
githubUrlhttps://github.com/neomjs/neo/issues/7101
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 23, 2025, 2:14 PM

Refactor: Remove redundant createBindings() call from onConstructed

Closed v10.0.0 enhancement
tobiu
tobiu commented on Jul 23, 2025, 2:13 PM

Description

During the refactoring of the state provider logic into component.Abstract, it was identified that createBindings() is called from two separate lifecycle methods: initConfig() and onConstructed().

The call sequence is as follows:

  1. Neo.create()
  2. constructor() -> construct()
  3. initConfig() -> createBindings()
  4. onConstructed() -> createBindings() (redundant)

initConfig() runs first, during the initial construction and configuration of the component. onConstructed() is called by Neo.create() after the constructor chain has completed.

Since initConfig() already sets up the necessary bindings based on the component's configuration, the subsequent call in onConstructed() is redundant and serves no purpose. It attempts to create the same bindings a second time.

Task

Remove the redundant call to this.getStateProvider()?.createBindings(this) from the onConstructed() method within src/component/Abstract.mjs. The call within initConfig() should remain as it is the correct and sufficient place for this logic.

Affected Files

  • src/component/Abstract.mjs
tobiu assigned to @tobiu on Jul 23, 2025, 2:13 PM
tobiu added the enhancement label on Jul 23, 2025, 2:14 PM
tobiu referenced in commit 17c5165 - "Refactor: Remove redundant createBindings() call from onConstructed #7101" on Jul 23, 2025, 2:14 PM
tobiu closed this issue on Jul 23, 2025, 2:14 PM