Skip to content
Closed
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,46 @@ if (result.status === FlowRunStatus.Failed) {
}
```

## Canceling Wait Operations

Use `AbortSignal` to cancel waiting operations when needed:

```typescript
const controller = new AbortController();

// Start waiting with abort signal
const waitPromise = run.waitForStatus(FlowRunStatus.Completed, {
timeoutMs: 60000,
signal: controller.signal,
});

// Cancel if user navigates away (browser example)
window.addEventListener('beforeunload', () => {
controller.abort();
});

// Or cancel on user action
document.getElementById('cancel-btn')?.addEventListener('click', () => {
controller.abort();
});

try {
await waitPromise;
console.log('Workflow completed:', run.output);
} catch (error) {
if (error.message.includes('Aborted')) {
console.log('User canceled the operation');
} else {
throw error; // Re-throw other errors
}
}
```

This is particularly useful in interactive applications where users might:
- Navigate away before workflow completion
- Cancel long-running operations
- Switch between different workflows

## Resource Cleanup

:::caution
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
draft: false
title: 'pgflow 0.7.2: Fix Missing Realtime Broadcasts for Step Events'
description: 'Critical fix for missing step:started and step:completed realtime events'
date: 2025-01-04
authors:
- jumski
tags:
- bugfix
- realtime
- client
- core
featured: true
---

import { Aside } from "@astrojs/starlight/components";

pgflow 0.7.2 fixes missing realtime broadcasts that prevented clients from receiving `step:started` and `step:completed` events. PostgreSQL's query optimizer was eliminating CTEs containing `realtime.send()` calls because they weren't referenced by subsequent operations.

## What's Fixed

- `step:started` events now broadcast when steps begin executing
- `step:completed` events now broadcast for empty map steps
- `step:completed` events now broadcast for cascade completions
- Client applySnapshot() methods added for proper initial state hydration without event emission

## Additional Changes

- Enhanced test coverage for realtime event lifecycles
- Documentation updates for abort signal support and empty map step behavior

## Upgrading

<Aside type="note" title="Migration Required">
This release includes database migrations. See the [update guide](/deploy/update-pgflow/) for instructions.
</Aside>

---

**Questions or issues?** Join our [Discord community](https://www.pgflow.dev/discord/) or [open an issue on GitHub](https://github.com/pgflow-dev/pgflow/issues).
Loading