mini app test#2225
Merged
Merged
Conversation
When the React app pushed a new state via __ANYTYPE_API__.setState, the host called C.BlockTextSetText to write the JSON sibling code block, but the React app's display never updated until a full reload. The same button click would send the same state value over and over because the local React mirror was frozen. Root cause: anytype-heart's BlockSetText event is debounced when echoing back to the originating client (presumably to avoid hammering the CRDT layer on every keystroke during normal text editing). The local mobx store didn't see the change in time, so the embed component's observer didn't re-render, the round-trip back to the iframe never started, and the React app's 'anytype:state' listener was never fired. Anytype's own normal text input solves this by doing two writes — local mobx mutation first, then heart sync — see U.Data.blockSetText in src/ts/lib/util/data.ts:449. This commit applies the same pattern to the anytypeMiniAppState case: S.Block.updateContent before C.BlockTextSetText. The local update fires the embed observer synchronously, the new appStateText is detected on the next render, init/setContent re-runs, the iframe receives the updated payload via the state-only fast path, and the React app's listener finally sees the new state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # electron/ts/server.ts # package-lock.json # src/ts/component/block/embed.tsx
Strip auto-formatter drift introduced by the mini-app commits in embed.tsx and lib/util/embed.ts (bracket-access spacing, trailing whitespace, JSX prop reflow) so the diff vs develop is now only the real mini-app additions. Revert main.ts to develop — the [Startup] console.logs and 5s extension-install timeout race weren't needed.
ra3orblade
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.