|
7 | 7 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> |
8 | 8 |
|
9 | 9 |
|
10 | | -<title>index – blockr</title> |
| 10 | +<title>reactivity – blockr</title> |
11 | 11 | <style> |
12 | 12 | code{white-space: pre-wrap;} |
13 | 13 | span.smallcaps{font-variant: small-caps;} |
|
100 | 100 | <span class="menu-text">How-To</span></a> |
101 | 101 | </li> |
102 | 102 | <li class="nav-item"> |
103 | | - <a class="nav-link active" href="../fundamentals/index.html" aria-current="page"> |
| 103 | + <a class="nav-link active" href="../fundamentals/01-reactivity.html" aria-current="page"> |
104 | 104 | <span class="menu-text">Fundamentals</span></a> |
105 | 105 | </li> |
106 | 106 | <li class="nav-item"> |
|
137 | 137 | <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" role="button" data-bs-target=".quarto-sidebar-collapse-item" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> |
138 | 138 | <i class="bi bi-layout-text-sidebar-reverse"></i> |
139 | 139 | </button> |
140 | | - <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="../fundamentals/index.html">index.html</a></li></ol></nav> |
| 140 | + <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="../fundamentals/01-reactivity.html">Reactivity</a></li></ol></nav> |
141 | 141 | <a class="flex-grow-1" role="navigation" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> |
142 | 142 | </a> |
143 | 143 | </div> |
|
151 | 151 | <ul class="list-unstyled mt-1"> |
152 | 152 | <li class="sidebar-item"> |
153 | 153 | <div class="sidebar-item-container"> |
154 | | - <a href="../fundamentals/index.html" class="sidebar-item-text sidebar-link active"> |
155 | | - <span class="menu-text">index.html</span></a> |
| 154 | + <a href="../fundamentals/01-reactivity.html" class="sidebar-item-text sidebar-link active"> |
| 155 | + <span class="menu-text">Reactivity</span></a> |
156 | 156 | </div> |
157 | 157 | </li> |
158 | 158 | </ul> |
159 | 159 | </div> |
160 | 160 | </nav> |
161 | 161 | <div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div> |
162 | 162 | <!-- margin-sidebar --> |
163 | | - <div id="quarto-margin-sidebar" class="sidebar margin-sidebar zindex-bottom"> |
164 | | - |
| 163 | + <div id="quarto-margin-sidebar" class="sidebar margin-sidebar"> |
| 164 | + <nav id="TOC" role="doc-toc" class="toc-active"> |
| 165 | + <h2 id="toc-title">On this page</h2> |
| 166 | + |
| 167 | + <ul> |
| 168 | + <li><a href="#reactivity" id="toc-reactivity" class="nav-link active" data-scroll-target="#reactivity">Reactivity</a> |
| 169 | + <ul class="collapse"> |
| 170 | + <li><a href="#overview" id="toc-overview" class="nav-link" data-scroll-target="#overview">Overview</a></li> |
| 171 | + <li><a href="#example" id="toc-example" class="nav-link" data-scroll-target="#example">Example</a></li> |
| 172 | + <li><a href="#errors" id="toc-errors" class="nav-link" data-scroll-target="#errors">Errors</a></li> |
| 173 | + </ul></li> |
| 174 | + </ul> |
| 175 | +</nav> |
165 | 176 | </div> |
166 | 177 | <!-- main --> |
167 | 178 | <main class="content" id="quarto-document-content"><header id="title-block-header" class="quarto-title-block"></header> |
168 | 179 |
|
169 | 180 |
|
170 | 181 |
|
171 | 182 |
|
| 183 | +<section id="reactivity" class="level1"> |
| 184 | +<h1>Reactivity</h1> |
| 185 | +<section id="overview" class="level2"> |
| 186 | +<h2 class="anchored" data-anchor-id="overview">Overview</h2> |
| 187 | +<p>blockr uses a concept called reactivity to ensure that any changes you make to a block in your workflow are automatically reflected in all downstream blocks. This means that when you update one part of your workflow, you don’t need to manually trigger updates elsewhere, everything downstream adjusts automatically. It’s the same idea that powers the interactivity you’re used to seeing in spreadsheets: if cell A1 contains a price and cell B1 calculates tax with =A1 * 0.2, changing A1 instantly updates B1. blockr works the same way, but for entire data transformation steps instead of individual cells.</p> |
| 188 | +<div class="callout callout-style-default callout-note callout-titled"> |
| 189 | +<div class="callout-header d-flex align-content-center"> |
| 190 | +<div class="callout-icon-container"> |
| 191 | +<i class="callout-icon"></i> |
| 192 | +</div> |
| 193 | +<div class="callout-title-container flex-fill"> |
| 194 | +Note |
| 195 | +</div> |
| 196 | +</div> |
| 197 | +<div class="callout-body-container callout-body"> |
| 198 | +<p>blockr did not invent reactivity! blockr is built on the <a href="https://shiny.posit.co/">Shiny</a> framework in R, which itself borrowed the ideas of reactivity from <a href="https://www.meteor.com/">Meteor</a></p> |
| 199 | +</div> |
| 200 | +</div> |
| 201 | +</section> |
| 202 | +<section id="example" class="level2"> |
| 203 | +<h2 class="anchored" data-anchor-id="example">Example</h2> |
| 204 | +<p>If you have already completed the <a href="../tutorials/02-build-a-dashboard.html">Build a dashboard</a> tutorial, you have already seen reactivity in action. In that tutorial you learnt how to build a simple dashboard which uses a filter to update a plot on penguins:</p> |
| 205 | +<p><img src="01-img-01.png" class="img-fluid"></p> |
| 206 | +<p>Let’s zoom into the workflow to better understand what is going on. Here, we can see that as one block updates, all downstream blocks update:</p> |
| 207 | +<p><img src="01-img-02.png" class="img-fluid"></p> |
| 208 | +<p>In this example, this results in only a single block updating.</p> |
| 209 | +<p>A downstream block is any block that depends on (directly or indirectly) the output of a given block. In other words, it comes after it in the workflow. If data flows from A → B → C, then B and C are both downstream of A. This means that for complicated workflows, a change higher up the workflow can result in many blocks being updated:</p> |
| 210 | +<p><img src="01-img-03.png" class="img-fluid"></p> |
| 211 | +<p>Note that upstream blocks never get updated. In our simple example, this means that our data block does <strong>not</strong> get updated, because it is upstream of our filter block:</p> |
| 212 | +<p><img src="01-img-04.png" class="img-fluid"></p> |
| 213 | +</section> |
| 214 | +<section id="errors" class="level2"> |
| 215 | +<h2 class="anchored" data-anchor-id="errors">Errors</h2> |
| 216 | +<p>Sometimes updating a block can causes errors downstream.</p> |
| 217 | +<p>For example, again using our simple penguins dashboard, if we update the dataset block to use a dataset other than penguins, it will causes errors downstream:</p> |
| 218 | +<p><img src="01-img-05.png" class="img-fluid"></p> |
| 219 | +<p>This happens because the downstream filter and plot blocks user variables from the penguins dataset. When this dataset changes, these variables are no longer available and so the downstream blocks error to let us know they are trying to use variables that no longer exist. In this instance to fix these errors, we just need to update the variables used in the downstream blocks to those found in the new dataset.</p> |
172 | 220 |
|
173 | 221 |
|
| 222 | +</section> |
| 223 | +</section> |
174 | 224 |
|
175 | 225 | </main> <!-- /main --> |
176 | 226 | <script id="quarto-html-after-body" type="application/javascript"> |
|
0 commit comments