LearnNewsExamplesServices
Frontmatter
id6996
titleEncourage Pure VDOM Effects
stateClosed
labels
enhancementno auto close
assignees[]
createdAtJul 9, 2025, 12:57 PM
updatedAtOct 24, 2025, 12:07 PM
githubUrlhttps://github.com/neomjs/neo/issues/6996
authortobiu
commentsCount2
parentIssue6992
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 24, 2025, 12:07 PM

Encourage Pure VDOM Effects

Closed v11.0.0 enhancementno auto close
tobiu
tobiu commented on Jul 9, 2025, 12:57 PM

1. Summary

Define and promote best practices for writing "pure" VDOM-generating methods (e.g., createVdom()) within functional components. This ensures that the output of these methods is solely determined by their inputs (component configs) and that they produce no side effects, which is crucial for predictability and enabling future optimizations like memoization.

2. Rationale

The Neo.core.Effect system automatically re-executes VDOM-generating methods when their dependencies changes. For this system to be truly robust and performant, these methods should ideally be pure functions. Purity makes components easier to reason about, test, and debug. It also unlocks significant performance gains through memoization, as the output can be safely cached if inputs remain unchanged.

3. Scope & Implementation Plan

  1. Define Purity Guidelines: Clearly document what constitutes a "pure" VDOM-generating method in the context of Neo.mjs functional components. This includes avoiding direct DOM manipulation, external state modification, or reliance on non-reactive global state within createVdom().
  2. Documentation: Add a section to the functional component documentation explaining the concept of pure effects and why it's important.
  3. Linting/Static Analysis (Optional, Future): Explore the possibility of adding linting rules or static analysis checks to identify potential impurities in createVdom() methods.

4. Definition of Done

  • Clear guidelines for writing pure VDOM-generating methods are documented.
  • The documentation explains the benefits of purity and provides examples.
tobiu added parent issue #6992 on Jul 9, 2025, 12:57 PM
tobiu added the enhancement label on Jul 9, 2025, 12:57 PM
tobiu removed the stale label on Oct 8, 2025, 11:39 AM
tobiu added the no auto close label on Oct 8, 2025, 11:39 AM
tobiu
tobiu Oct 24, 2025, 12:07 PM

dropped

tobiu closed this issue on Oct 24, 2025, 12:07 PM