Skip to content

Fix buffering events in JointJS async context - #1810

Merged
Xiao-zhen-Liu merged 1 commit into
masterfrom
zuozhi-fix-async
Jan 27, 2023
Merged

Xiao-zhen-Liu merged 1 commit into
masterfrom
zuozhi-fix-async

Conversation

@zuozhiw

@zuozhiw zuozhiw commented Jan 27, 2023

Copy link
Copy Markdown
Contributor

This PR fixes an issue when the JointJS paper is rendered in async mode.
In async mode, the view is not available until it's completely rendered. Therefore, we need to buffer some UI events until we know it's completely rendered. We created a function bufferWhileAsync to do this.

The old bufferWhileAsync implementation has problems: for each input event, multiple duplicate output events (3 events) are emitted. This PR rewrites the implementation to make it correctly produce a single output event.

@zuozhiw
zuozhiw requested a review from Xiao-zhen-Liu January 27, 2023 00:46

@Xiao-zhen-Liu Xiao-zhen-Liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@Xiao-zhen-Liu
Xiao-zhen-Liu merged commit 7d17cbc into master Jan 27, 2023
@Xiao-zhen-Liu
Xiao-zhen-Liu deleted the zuozhi-fix-async branch January 27, 2023 17:51
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
This PR fixes an issue when the JointJS paper is rendered in async mode.
In async mode, the view is not available until it's completely rendered.
Therefore, we need to buffer some UI events until we know it's
completely rendered. We created a function `bufferWhileAsync` to do
this.

The old `bufferWhileAsync` implementation has problems: for each input
event, multiple duplicate output events (3 events) are emitted. This PR
rewrites the implementation to make it correctly produce a single output
event.
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Sep 27, 2026
…e#8695)

### What changes were proposed in this PR?

Deletes `ObservableContextManager` and re-parents its only subclass,
`JointGraphContext`, onto `ContextManager`. **+8/−223 lines.** There is
no behaviour change: the removed layer only emitted enter/exit events on
Subjects nothing subscribes to, and `JointGraphContext`'s own `enter` /
`exit` overrides still call `super`.

### History

| | |
| --- | --- |
| **Introduced by** | apache#1433 (2022-02-07), "Bugfix for Albert load
workflow opt". `JointGraphContext` used the change stream to buffer
JointJS events in async mode |
| **Usage removed by** | apache#1810 (2023-01-27), "Fix buffering events in
JointJS async context". It deleted both `getChangeContextStream()`
subscribers |

It has been dead for over three and a half years. Every paper-context
enter/exit since then has emitted into streams with no reader.

> Reviewer note: `context.spec.ts` goes from 23 cases to 12. The 11
stream-only cases are deleted. 4 others move into
`describe("ContextManager")` with their stream assertions dropped,
because they cover `ContextManager` paths the original 8 cases did not:
object-identity contexts, nested unwinding when a callable throws, falsy
return values, and re-entering the same value.

### Any related issues, documentation, discussions?

Closes apache#8694

### How was this PR tested?

No new tests. The kept `ContextManager` cases cover the surviving code.

From `frontend/`:

- `npx ng test --watch=false --include='**/context.spec.ts'
--include='**/joint-graph-wrapper.spec.ts'
--include='**/workflow-editor.component.spec.ts'`: 3 files, 199 tests,
all pass.
- `yarn format:ci`: clean.
- `npx ng build`: success.

To re-check:

```
git grep -n "ObservableContextManager\|getChangeContextStream\|getEnterStream\|getExitStream" -- frontend   # no hits
```

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants