@ea-lab/reactive-json-docs 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/public/rjbuild/docs/advanced-concepts/data-mapping.md +76 -0
- package/public/rjbuild/docs/advanced-concepts/data-mapping.yaml +140 -0
- package/public/rjbuild/docs/advanced-concepts/data-processors.md +373 -0
- package/public/rjbuild/docs/advanced-concepts/data-processors.yaml +309 -0
- package/public/rjbuild/docs/advanced-concepts/index.md +9 -0
- package/public/rjbuild/docs/advanced-concepts/index.yaml +15 -0
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development-guide-llm.md +2 -0
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/plugin-system.md +2 -0
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/plugin-system.yaml +2 -0
- package/public/rjbuild/docs/core/dataMapping/index.md +31 -0
- package/public/rjbuild/docs/core/dataMapping/index.yaml +24 -0
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.md +131 -0
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +376 -0
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +4 -3
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +114 -6
- package/public/rjbuild/docs/core/reaction/fetchData.md +136 -10
- package/public/rjbuild/docs/core/reaction/fetchData.yaml +222 -9
- package/public/rjbuild/docs/core/reaction/submitData.md +139 -4
- package/public/rjbuild/docs/core/reaction/submitData.yaml +50 -2
- package/public/rjbuild/docs/{getting-started.md → getting-started/index.md} +2 -2
- package/public/rjbuild/docs/{getting-started.yaml → getting-started/index.yaml} +4 -2
- package/public/rjbuild/docs/getting-started/rjbuild-structure.md +352 -0
- package/public/rjbuild/docs/getting-started/rjbuild-structure.yaml +415 -0
- package/public/rjbuild/docs/install.yaml +682 -681
- /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.md +0 -0
- /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.yaml +0 -0
- /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.md +0 -0
- /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.yaml +0 -0
- /package/public/rjbuild/docs/{template.md → getting-started/template.md} +0 -0
- /package/public/rjbuild/docs/{template.yaml → getting-started/template.yaml} +0 -0
|
@@ -15,6 +15,8 @@ renderView:
|
|
|
15
15
|
- `data` (object, optional): The data to send. If not specified, data is sent in an object with the structure `{ data: globalDataContext.templateData }`. If `__state` exists in the context, it is automatically added.
|
|
16
16
|
- `refreshAppOnResponse` (boolean, optional): If true (default), reloads the application with the server response. If false, the response is ignored and **no change is made to the application's state or display** (just like `fetchData`).
|
|
17
17
|
- `submitSilently` (boolean, optional): If true, doesn't apply visual disabling styles during submission
|
|
18
|
+
- `updateOnlyData` (boolean, optional): When true and `refreshAppOnResponse` is true, only updates the data section instead of replacing the entire RjBuild. Preserves templates and renderView. Default: false.
|
|
19
|
+
- `updateDataAtLocation` (string, optional): When `updateOnlyData` is true, specifies where to place the response data using template path syntax (e.g., "~~.userProfile", "~.config.settings"). If not specified, replaces the entire data object.
|
|
18
20
|
|
|
19
21
|
## Behavior
|
|
20
22
|
- Only one submission can be active at a time (global lock)
|
|
@@ -127,15 +129,61 @@ renderView:
|
|
|
127
129
|
- Save progression state
|
|
128
130
|
- Maintain consistency between client and server
|
|
129
131
|
|
|
132
|
+
## Data-Only Update Examples (@ea-lab/reactive-json@0.2.0)
|
|
133
|
+
|
|
134
|
+
The properties `updateOnlyData` and `updateDataAtLocation` work identically for `submitData` and `fetchData`.
|
|
135
|
+
|
|
136
|
+
> **⚠️ Important:** When using `updateOnlyData: true`, the server response must contain **data only**, not a complete RjBuild structure. The response should be the raw data object, not wrapped in `{data: {...}, renderView: [...], templates: {...}}`.
|
|
137
|
+
|
|
138
|
+
> **Since this documentation site only supports GET requests**, interactive examples for `submitData` cannot be demonstrated here. However, the behavior is exactly the same as `fetchData`.
|
|
139
|
+
|
|
140
|
+
### ➡️ **See Interactive Examples**
|
|
141
|
+
|
|
142
|
+
Please refer to the **[fetchData documentation](/docs/core/reaction/fetchData)** to see fully interactive demonstrations of:
|
|
143
|
+
|
|
144
|
+
- **Complete Data Replacement** with `updateOnlyData: true`
|
|
145
|
+
- **Targeted Data Updates** with `updateDataAtLocation`
|
|
146
|
+
- **Visual feedback** showing exactly which data sections change
|
|
147
|
+
|
|
148
|
+
### 🔄 **For submitData, the syntax is identical:**
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
# Complete data replacement after form submission
|
|
152
|
+
actions:
|
|
153
|
+
- what: submitData
|
|
154
|
+
on: click
|
|
155
|
+
url: "/api/user/save"
|
|
156
|
+
data: ~~.formData
|
|
157
|
+
updateOnlyData: true
|
|
158
|
+
refreshAppOnResponse: true
|
|
159
|
+
|
|
160
|
+
# Targeted update after form submission
|
|
161
|
+
actions:
|
|
162
|
+
- what: submitData
|
|
163
|
+
on: click
|
|
164
|
+
url: "/api/user/save"
|
|
165
|
+
data: ~~.formData
|
|
166
|
+
updateOnlyData: true
|
|
167
|
+
updateDataAtLocation: "~~.savedProfile"
|
|
168
|
+
refreshAppOnResponse: true
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 💡 **Common Use Cases for submitData:**
|
|
172
|
+
|
|
173
|
+
- **Form submissions** that return updated record data
|
|
174
|
+
- **Profile updates** that preserve application state
|
|
175
|
+
- **Configuration saves** that update specific settings sections
|
|
176
|
+
- **Multi-step forms** where each step updates different data sections
|
|
177
|
+
|
|
130
178
|
## Limitations
|
|
131
179
|
- Only one submission can be active at a time (global lock)
|
|
132
180
|
- Only the first level of the `data` object is evaluated as templates
|
|
133
181
|
- Only POST (or custom method) requests are supported
|
|
134
|
-
- The server response must be a valid rjbuild if `refreshAppOnResponse` is true
|
|
182
|
+
- The server response must be a valid rjbuild if `refreshAppOnResponse` is true and `updateOnlyData` is false
|
|
183
|
+
- When `updateOnlyData` is true, the response must contain **data only** (not a complete RjBuild structure)
|
|
135
184
|
- No built-in error handling beyond console logging
|
|
136
185
|
- No support for request cancellation
|
|
137
186
|
- No support for timeouts
|
|
138
187
|
- No support for dynamic URLs (URLs must be static strings)
|
|
139
188
|
- No support for query parameters in URL templates
|
|
140
189
|
- No support for complex URL routing or path generation
|
|
141
|
-
|
|
@@ -53,7 +53,7 @@ data:
|
|
|
53
53
|
isAdmin: true
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
> 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/template) which covers `~>key` and `~~>key` notations.
|
|
56
|
+
> 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/getting-started/template) which covers `~>key` and `~~>key` notations.
|
|
57
57
|
|
|
58
58
|
### Basic Elements
|
|
59
59
|
|
|
@@ -156,4 +156,4 @@ data:
|
|
|
156
156
|
2. Check out the [elements documentation](/docs/core/element) to discover all available components
|
|
157
157
|
3. Learn how to use the [action system](/docs/core/action) to create interactive interfaces
|
|
158
158
|
4. Discover the [reaction system](/docs/core/reaction) to handle user interactions
|
|
159
|
-
5. If needed, learn how to [extend Reactive-JSON](/docs/
|
|
159
|
+
5. If needed, learn how to [extend Reactive-JSON](/docs/advanced-concepts/plugins) with your own components
|
|
@@ -3,6 +3,8 @@ renderView:
|
|
|
3
3
|
content: |
|
|
4
4
|
# Reactive-JSON Getting Started Guide
|
|
5
5
|
|
|
6
|
+
> Dev note: This page needs to be rewritten.
|
|
7
|
+
|
|
6
8
|
## Introduction
|
|
7
9
|
|
|
8
10
|
Reactive-JSON is a powerful library that allows you to create interactive user interfaces using only JSON/YAML configurations. No need to write complex JavaScript code - simply define your interface and its behavior declaratively.
|
|
@@ -39,7 +41,7 @@ renderView:
|
|
|
39
41
|
- `~.` : Local context (relative to current template)
|
|
40
42
|
- `~~.` : Global context (access to global data)
|
|
41
43
|
|
|
42
|
-
> 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/template) which covers `~>key` and `~~>key` notations.
|
|
44
|
+
> 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/getting-started/template) which covers `~>key` and `~~>key` notations.
|
|
43
45
|
|
|
44
46
|
- type: RjBuildDescriber
|
|
45
47
|
title: "Template System Example"
|
|
@@ -221,4 +223,4 @@ renderView:
|
|
|
221
223
|
2. Check out the [elements documentation](/docs/core/element) to discover all available components
|
|
222
224
|
3. Learn how to use the [action system](/docs/core/action) to create interactive interfaces
|
|
223
225
|
4. Discover the [reaction system](/docs/core/reaction) to handle user interactions
|
|
224
|
-
5. If needed, learn how to [extend Reactive-JSON](/docs/
|
|
226
|
+
5. If needed, learn how to [extend Reactive-JSON](/docs/advanced-concepts/plugins) with your own components
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# RjBuild File Structure
|
|
2
|
+
|
|
3
|
+
## What is an RjBuild?
|
|
4
|
+
|
|
5
|
+
An **RjBuild** is the standard file format used by Reactive-JSON to build interactive web applications. It is a JSON or YAML structure that completely describes a user interface, its data, and behavior, without requiring traditional JavaScript code.
|
|
6
|
+
|
|
7
|
+
> By extension, we also call "RjBuild" any fragment of this structure, particularly a portion of `renderView` and `templates` that can be reused or included in other RjBuilds.
|
|
8
|
+
|
|
9
|
+
### Supported Formats
|
|
10
|
+
|
|
11
|
+
An RjBuild can be written in two formats:
|
|
12
|
+
|
|
13
|
+
- **YAML** (recommended): More readable and easier to write for humans, ideal for creation and maintenance
|
|
14
|
+
- **JSON**: Standard supported format, useful for programmatic generation or integration with existing tools
|
|
15
|
+
|
|
16
|
+
**YAML is preferable** for most use cases as it offers better readability, allows comments, and is more tolerant of minor syntax errors.
|
|
17
|
+
|
|
18
|
+
## Basic Structure of an RjBuild
|
|
19
|
+
|
|
20
|
+
Any RjBuild file can contain up to four main sections:
|
|
21
|
+
|
|
22
|
+
- `renderView`: User interface structure (required)
|
|
23
|
+
- `templates`: Reusable components (optional)
|
|
24
|
+
- `data`: Initial state and data (optional)
|
|
25
|
+
- `additionalDataSource`: External data sources (optional)
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
renderView: # User interface structure (required)
|
|
29
|
+
- type: div
|
|
30
|
+
content: "Hello World"
|
|
31
|
+
|
|
32
|
+
templates: # Reusable components (optional)
|
|
33
|
+
myComponent:
|
|
34
|
+
type: div
|
|
35
|
+
content: "Template content"
|
|
36
|
+
|
|
37
|
+
data: # Initial state and data (optional)
|
|
38
|
+
message: "Welcome!"
|
|
39
|
+
user:
|
|
40
|
+
name: "John"
|
|
41
|
+
|
|
42
|
+
additionalDataSource: # External data sources (optional)
|
|
43
|
+
- src: "/api/data.json"
|
|
44
|
+
path: ~~.dynamicData
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Section `renderView` (Required)
|
|
48
|
+
|
|
49
|
+
The `renderView` section defines the **user interface** that will be displayed. It is the only required section of an RjBuild.
|
|
50
|
+
|
|
51
|
+
### Role
|
|
52
|
+
- Determines the visual structure of the application
|
|
53
|
+
- Defines the components to display and their organization
|
|
54
|
+
- Specifies interactions and behaviors
|
|
55
|
+
|
|
56
|
+
### Structure
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
renderView:
|
|
60
|
+
- type: ComponentName # Type of component to render
|
|
61
|
+
content: "Content" # Component content
|
|
62
|
+
attributes: # HTML attributes (optional)
|
|
63
|
+
class: "css-class"
|
|
64
|
+
actions: # Interactive actions (optional)
|
|
65
|
+
- what: hide
|
|
66
|
+
on: click
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Examples
|
|
70
|
+
|
|
71
|
+
#### Simple interface
|
|
72
|
+
```yaml
|
|
73
|
+
renderView:
|
|
74
|
+
- type: div
|
|
75
|
+
content:
|
|
76
|
+
- type: h1
|
|
77
|
+
content: "My Application"
|
|
78
|
+
- type: p
|
|
79
|
+
content: "Welcome!"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### With dynamic data
|
|
83
|
+
```yaml
|
|
84
|
+
renderView:
|
|
85
|
+
- type: div
|
|
86
|
+
content: ["Hello ", ~~.user.name, "!"]
|
|
87
|
+
|
|
88
|
+
data:
|
|
89
|
+
user:
|
|
90
|
+
name: "Marie"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Section `data` (Optional)
|
|
94
|
+
|
|
95
|
+
The `data` section contains the **initial state** of the application. This data can be read and modified by components.
|
|
96
|
+
|
|
97
|
+
### Role
|
|
98
|
+
- Provides the initial state of the application
|
|
99
|
+
- Stores data modifiable by user interactions
|
|
100
|
+
- Enables data sharing between components
|
|
101
|
+
|
|
102
|
+
### Structure
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
data:
|
|
106
|
+
# Simple data
|
|
107
|
+
title: "My Site"
|
|
108
|
+
isLoggedIn: false
|
|
109
|
+
|
|
110
|
+
# Objects
|
|
111
|
+
user:
|
|
112
|
+
name: "John"
|
|
113
|
+
email: "john@example.com"
|
|
114
|
+
|
|
115
|
+
# Arrays
|
|
116
|
+
items:
|
|
117
|
+
- name: "Item 1"
|
|
118
|
+
active: true
|
|
119
|
+
- name: "Item 2"
|
|
120
|
+
active: false
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Data Access
|
|
124
|
+
|
|
125
|
+
To use data in a component, you can use the following syntax:
|
|
126
|
+
|
|
127
|
+
- **`~~.`**: Global access to data from anywhere in the RjBuild
|
|
128
|
+
- **`~.`**: Local access to data from the current context (template)
|
|
129
|
+
|
|
130
|
+
### Usage Examples
|
|
131
|
+
|
|
132
|
+
#### Forms with state
|
|
133
|
+
```yaml
|
|
134
|
+
renderView:
|
|
135
|
+
- type: TextField
|
|
136
|
+
label: "Name"
|
|
137
|
+
dataLocation: ~~.user.name
|
|
138
|
+
- type: div
|
|
139
|
+
content: ["Entered name: ", ~~.user.name]
|
|
140
|
+
|
|
141
|
+
data:
|
|
142
|
+
user:
|
|
143
|
+
name: "Initial value"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Conditional display
|
|
147
|
+
```yaml
|
|
148
|
+
renderView:
|
|
149
|
+
- type: div
|
|
150
|
+
content: "User is logged in!"
|
|
151
|
+
actions:
|
|
152
|
+
- what: hide
|
|
153
|
+
when: ~~.isLoggedIn
|
|
154
|
+
is: false
|
|
155
|
+
|
|
156
|
+
data:
|
|
157
|
+
isLoggedIn: true
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
> You can get more information about data access in the [template system documentation](./template.md).
|
|
161
|
+
|
|
162
|
+
## Section `templates` (Optional)
|
|
163
|
+
|
|
164
|
+
The `templates` section defines **reusable components** that can be used in `renderView` or other templates.
|
|
165
|
+
|
|
166
|
+
### Role
|
|
167
|
+
- Avoids code duplication
|
|
168
|
+
- Enables reuse of complex structures
|
|
169
|
+
- Facilitates maintenance and modifications
|
|
170
|
+
|
|
171
|
+
### Structure
|
|
172
|
+
|
|
173
|
+
```yaml
|
|
174
|
+
templates:
|
|
175
|
+
templateName: # Template name
|
|
176
|
+
type: ComponentName # Template structure
|
|
177
|
+
content: "Content"
|
|
178
|
+
|
|
179
|
+
multipleComponents: # Template with multiple components
|
|
180
|
+
- type: div
|
|
181
|
+
content: "Component 1"
|
|
182
|
+
- type: p
|
|
183
|
+
content: "Component 2"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Using templates
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
renderView:
|
|
190
|
+
- load: templateName # Loads and displays the template
|
|
191
|
+
|
|
192
|
+
templates:
|
|
193
|
+
templateName:
|
|
194
|
+
type: div
|
|
195
|
+
content: "I am a reusable template!"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Data Context
|
|
199
|
+
|
|
200
|
+
Templates create their own **data context** when used with components like `Switch`:
|
|
201
|
+
|
|
202
|
+
```yaml
|
|
203
|
+
renderView:
|
|
204
|
+
- type: Switch
|
|
205
|
+
content: ~~.users # Iterates over each user
|
|
206
|
+
singleOption:
|
|
207
|
+
load: userCard # Each user uses the template
|
|
208
|
+
|
|
209
|
+
templates:
|
|
210
|
+
userCard:
|
|
211
|
+
type: div
|
|
212
|
+
content:
|
|
213
|
+
- "Name: "
|
|
214
|
+
- ~.name # Local access to current user's name
|
|
215
|
+
- " (Admin: "
|
|
216
|
+
- ~~.isAdmin # Global access to settings
|
|
217
|
+
|
|
218
|
+
data:
|
|
219
|
+
isAdmin: true
|
|
220
|
+
users:
|
|
221
|
+
- name: "Alice"
|
|
222
|
+
- name: "Bob"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Section `additionalDataSource` (Optional)
|
|
226
|
+
|
|
227
|
+
The `additionalDataSource` section allows **loading data from external sources** during application initialization.
|
|
228
|
+
|
|
229
|
+
### Role
|
|
230
|
+
- Integrates dynamic data from APIs
|
|
231
|
+
- Enables asynchronous data loading
|
|
232
|
+
- Separates static data from dynamic data
|
|
233
|
+
|
|
234
|
+
### Structure
|
|
235
|
+
|
|
236
|
+
```yaml
|
|
237
|
+
additionalDataSource:
|
|
238
|
+
- src: "/api/endpoint" # Source URL (required)
|
|
239
|
+
path: ~~.targetPath # Where to place the data (optional)
|
|
240
|
+
method: GET # HTTP method (optional, default: GET)
|
|
241
|
+
blocking: true # Block rendering (optional, default: false)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Properties
|
|
245
|
+
- **`src`** (required): URL of the data source
|
|
246
|
+
- **`path`** (optional): Path where to place the data (template syntax)
|
|
247
|
+
- **`method`** (optional): HTTP method (GET, POST, etc.)
|
|
248
|
+
- **`dataMapping`** (optional): Configure selective data dispatch using mapping processors
|
|
249
|
+
- **`blocking`** (optional): If `true`, waits for loading before displaying
|
|
250
|
+
|
|
251
|
+
### Loading Modes
|
|
252
|
+
|
|
253
|
+
#### Blocking loading
|
|
254
|
+
```yaml
|
|
255
|
+
additionalDataSource:
|
|
256
|
+
- src: "/api/user-profile.json"
|
|
257
|
+
path: ~~.currentUser
|
|
258
|
+
blocking: true # Page waits for loading
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### Non-blocking loading
|
|
262
|
+
```yaml
|
|
263
|
+
additionalDataSource:
|
|
264
|
+
- src: "/api/notifications.json"
|
|
265
|
+
path: ~~.notifications
|
|
266
|
+
blocking: false # Page displays immediately
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Data Placement
|
|
270
|
+
|
|
271
|
+
#### With specific path
|
|
272
|
+
```yaml
|
|
273
|
+
additionalDataSource:
|
|
274
|
+
- src: "/api/user.json"
|
|
275
|
+
path: ~~.currentUser
|
|
276
|
+
|
|
277
|
+
# Data will be placed in data.currentUser
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Root-level merge
|
|
281
|
+
```yaml
|
|
282
|
+
additionalDataSource:
|
|
283
|
+
- src: "/api/config.json"
|
|
284
|
+
# No path = direct merge into data
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Data Mapping Integration
|
|
288
|
+
|
|
289
|
+
Data Mapping can be used with `additionalDataSource` to selectively dispatch response data to specific locations:
|
|
290
|
+
|
|
291
|
+
```yaml
|
|
292
|
+
additionalDataSource:
|
|
293
|
+
- src: "/api/user-profile"
|
|
294
|
+
blocking: true
|
|
295
|
+
dataMapping:
|
|
296
|
+
simpleMapping:
|
|
297
|
+
stringMap:
|
|
298
|
+
"profile.displayName": { value: "user.name" }
|
|
299
|
+
"profile.email": { value: "user.email" }
|
|
300
|
+
"settings.theme":
|
|
301
|
+
value: "user.preferences.theme"
|
|
302
|
+
required: false
|
|
303
|
+
defaultValue: "light"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Note**: When `dataMapping` is configured, it takes priority over the `path` property. For more details, see [Data Mapping Documentation](../advanced-concepts/data-mapping.md).
|
|
307
|
+
|
|
308
|
+
### Complete Example
|
|
309
|
+
|
|
310
|
+
```yaml
|
|
311
|
+
renderView:
|
|
312
|
+
- type: div
|
|
313
|
+
content:
|
|
314
|
+
- type: h1
|
|
315
|
+
content: ["Hello ", ~~.currentUser.name]
|
|
316
|
+
- type: p
|
|
317
|
+
content: ["Version: ", ~~.systemConfig.version]
|
|
318
|
+
|
|
319
|
+
data:
|
|
320
|
+
currentUser:
|
|
321
|
+
name: "Loading..." # Temporary value
|
|
322
|
+
systemConfig:
|
|
323
|
+
version: "Loading..."
|
|
324
|
+
|
|
325
|
+
additionalDataSource:
|
|
326
|
+
# Critical user data (blocking)
|
|
327
|
+
- src: "/api/user-profile.json"
|
|
328
|
+
path: ~~.currentUser
|
|
329
|
+
blocking: true
|
|
330
|
+
|
|
331
|
+
# System configuration (non-blocking)
|
|
332
|
+
- src: "/api/system-config.json"
|
|
333
|
+
path: ~~.systemConfig
|
|
334
|
+
blocking: false
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Best Practices
|
|
338
|
+
|
|
339
|
+
### Organization
|
|
340
|
+
1. **Logical structure**: Organize your data by functional domain
|
|
341
|
+
2. **Reusable templates**: Create templates to avoid duplication
|
|
342
|
+
3. **Default values**: Provide temporary values for external data
|
|
343
|
+
|
|
344
|
+
### Performance
|
|
345
|
+
1. **Smart loading**: Use `blocking: true` only for critical data
|
|
346
|
+
2. **Minimal data**: Load only necessary data
|
|
347
|
+
3. **Optimized templates**: Avoid overly complex templates
|
|
348
|
+
|
|
349
|
+
### Maintainability
|
|
350
|
+
1. **Consistent naming**: Use clear conventions for templates and data
|
|
351
|
+
2. **Documentation**: Comment complex sections
|
|
352
|
+
3. **Validation**: Verify the structure of your external data
|