Repository navigation
fix: 节点命令改为队列,不再与 patch 争写同一份快照状态 #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4696d02
fix: 节点命令改为队列,不再与 patch 争写同一份快照状态
HarlonWang 5cc1ea6
fix: 待发命令改为 apply 内的局部变量;删除的节点不再收命令;时序测试改为验证先提交后送达
HarlonWang 0f4280c
fix: 一批 patch 的快照外副作用统一在提交后发生;从 report 重入的 apply 并入被打断的那一批
HarlonWang ccae0c1
refactor: 问题上报也等快照提交后再做,apply 不再支持重入;UINode.commands 收为 internal
HarlonWang de14c1f
refactor: Flush 作为参数穿过各 op 方法,去掉可空字段和 !!
HarlonWang 54352ad
fix: 一批的问题在它的命令发出之后再上报;clear() 也关掉被丢节点的队列
HarlonWang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import androidx.compose.runtime.mutableStateListOf | |
| import androidx.compose.runtime.mutableStateMapOf | ||
| import androidx.compose.runtime.snapshots.SnapshotStateList | ||
| import androidx.compose.runtime.snapshots.SnapshotStateMap | ||
| import kotlinx.coroutines.channels.Channel | ||
|
|
||
| /** One node of the page tree; the recomposition unit (docs/adr-003-kotlin-node-tree-and-registry.md). */ | ||
| class UINode internal constructor(val id: Int, val type: String) { | ||
|
|
@@ -12,8 +13,12 @@ class UINode internal constructor(val id: Int, val type: String) { | |
| /** Events the JS side registered a handler for. */ | ||
| val events: SnapshotStateMap<String, Boolean> = mutableStateMapOf() | ||
| val children: SnapshotStateList<UINode> = mutableStateListOf() | ||
| /** One-shot commands waiting for the component to consume them (`x` op). */ | ||
| val commands: SnapshotStateList<Command> = mutableStateListOf() | ||
| /** | ||
| * One-shot commands for the component (`x` op), oldest first, each sent once its flush is applied. A queue, not | ||
| * snapshot state (docs/adr-004 §3.2): the engine thread sends while the main thread receives, and a state list | ||
| * written from both conflicts when either snapshot applies. | ||
| */ | ||
| internal val commands = Channel<Command>(Channel.UNLIMITED) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [建议] |
||
| internal var parent: UINode? = null | ||
| /** Set once the creating flush is applied: `initial` props stop accepting writes. */ | ||
| internal var created = false | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.