Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/four-planes-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@platforma-open/milaboratories.rarefaction.model": patch
---

Switch to retentive outputs
4 changes: 2 additions & 2 deletions model/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const model = BlockModel.create()
/*************************
* OUTPUTS *
*************************/
.outputWithStatus('graphPFrame', (ctx) => {
.retentiveOutputWithStatus('graphPFrame', (ctx) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The change from outputWithStatus to retentiveOutputWithStatus for graphPFrame implies that this output will now retain its last successfully computed value even if subsequent computations fail or return undefined. Please ensure that all consumers of this output are aware of this change and handle potentially stale data appropriately. For example, if a UI component previously expected an undefined output to clear its display, it might now show old data. This is a significant behavioral change that could lead to unexpected user experiences if not properly managed downstream.

const pCols = ctx.outputs?.resolve('rarefactionPFrame')?.getPColumns();
if (pCols === undefined) {
return undefined;
Expand All @@ -86,7 +86,7 @@ export const model = BlockModel.create()
.output('rarefactionPFrameCols', (ctx) => {
return ctx.outputs?.resolve('rarefactionPFrame')?.getPColumns()?.map((p) => p.spec);
})
.outputWithStatus('table', (ctx) => {
.retentiveOutputWithStatus('table', (ctx) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Similarly, the switch to retentiveOutputWithStatus for the table output means it will retain its last valid state. It's important to verify that any components consuming this table output are designed to handle this retentive behavior, especially concerning how they react to situations where new data might be undefined or an error, but the output still provides the previous valid data.

const cols = ctx.outputs?.resolve('rarefactionPFrame')?.getPColumns();
if (cols === undefined) {
return undefined;
Expand Down