Skip to content

Add Reactive Patterns guide#4922

Open
abdelaziz-mahdy wants to merge 1 commit intokgrgreer:developmentfrom
abdelaziz-mahdy:docs/foam-reactive-patterns
Open

Add Reactive Patterns guide#4922
abdelaziz-mahdy wants to merge 1 commit intokgrgreer:developmentfrom
abdelaziz-mahdy:docs/foam-reactive-patterns

Conversation

@abdelaziz-mahdy
Copy link
Copy Markdown
Collaborator

Summary

  • Add comprehensive guide documenting all FOAM slot/reactive variations
  • Covers PropertySlot, slot(), dot(), SubSlot chains, expression, dynamic(), ExpressionSlot, map(), follow(), linkFrom(), and sub()
  • Includes source code references, internal mechanics diagrams, and a decision tree for choosing the right pattern
  • Documents trailing $ behavior and why it creates broken empty-name SubSlots

Motivation

The existing dynamic.md guide covers only expression vs dynamic(). This guide covers all 10+ reactive variations with code traces through Slot.js, FObject.js, and Property.js, making it easier for developers to understand which pattern to use and why.

Document all FOAM slot/reactive variations with source code
references, internal mechanics, and a decision tree:
PropertySlot, slot(), dot(), SubSlot chains, expression,
dynamic(), ExpressionSlot, map(), follow(), linkFrom(), sub().

Includes detailed analysis of trailing $ behavior and why
it creates a broken empty-name SubSlot.

**Returns**: `PropertySlot` (cached per instance in `obj.getPrivate_('name$')`)

**Use case**: When you need a slot reference to a single, flat property — for linking, following, or passing to views.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add that person.fname$ is a short-form for person.slot('fname')


**How it differs from `expression`**:

| Aspect | `expression` | `dynamic()` |
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second column should be expressions and slots.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants