You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suspense will wait for any awaitable object to finish before rendering the suspense tags.
145
+
146
+
### Specify which awaitable to wait for
147
+
148
+
If you have multiple suspense blocks with different awaitable, you can specify which awaitable to wait for or each suspense block will await everything.
149
+
150
+
Ex: `{% suspense obj obj2 %}`
151
+
152
+
```jinja
153
+
{% load suspense %}
154
+
155
+
<ul>
156
+
{% suspense obj %}
157
+
{% fallback %}
158
+
<li class="skeleton">Loading ... </li>
159
+
{% endfallback %}
160
+
161
+
{% for data in obj %}
162
+
<li>{{ data }}</li>
163
+
{% endfor %}
164
+
{% endsuspense %}
165
+
166
+
{% suspense obj2 %}
167
+
{% fallback %}
168
+
<li class="skeleton">Loading 2... </li>
169
+
{% endfallback %}
170
+
171
+
{% for data in obj2 %}
172
+
<li>{{ data }}</li>
173
+
{% endfor %}
174
+
{% endsuspense %}
175
+
</ul>
176
+
```
177
+
178
+
Important: If your async context variable is used by more than one suspense block, or you did not specify any variables on the tags, make sure to wrap your coroutines in tasks so they can be awaited multiple times.
0 commit comments