Skip to content

Add a hook to allow BinaryView subclasses to run code after snapshot data is applied#8040

Merged
bdash merged 1 commit intodevfrom
test_did_apply_snapshot_data
Mar 31, 2026
Merged

Add a hook to allow BinaryView subclasses to run code after snapshot data is applied#8040
bdash merged 1 commit intodevfrom
test_did_apply_snapshot_data

Conversation

@bdash
Copy link
Copy Markdown
Contributor

@bdash bdash commented Mar 25, 2026

Snapshot data is applied when loading from a database, rebasing the view, etc.

@negasora
Copy link
Copy Markdown
Member

What do you think about renaming this callback to OnAfterSnapshotDataApplied?
"Did apply" to me suggests that it'd return a bool returning whether or not snapshot data was applied.
Also most (all?) existing event-based callbacks use OnAfter/OnBefore prefixes iirc

@bdash
Copy link
Copy Markdown
Contributor Author

bdash commented Mar 30, 2026

I don't feel strongly about the naming so I'm happy to adjust it if it makes sense to do so.

In the API code, the only uses of OnBefore / OnAfter are in ProjectNotification. All of the On* methods appear to also be on the FooNotification types. Do you think it makes sense to continue that naming pattern in this different context?

@negasora
Copy link
Copy Markdown
Member

I think it does because people might be familiar with one callback and search OnBefore/OnAfter to see what other ones are available. On also kind of gives the message of "this is a called when an event happens".
Also if we want to add a callback later for before snapshot data is applied (idk why/when this would happen) we can use OnBeforeSnapshotDataApplied instead of e.g. AboutToApplySnapshotData.

…data is applied

Snapshot data is applied when loading from a database, rebasing the
view, etc.
@bdash bdash force-pushed the test_did_apply_snapshot_data branch from aad70d4 to ddd7aa4 Compare March 30, 2026 20:25
@bdash
Copy link
Copy Markdown
Contributor Author

bdash commented Mar 30, 2026

Renamed to OnAfterSnapshotDataApplied.

@bdash bdash added this to the Jotunheim milestone Mar 30, 2026
@bdash bdash merged commit ddd7aa4 into dev Mar 31, 2026
9 of 10 checks passed
@bdash bdash deleted the test_did_apply_snapshot_data branch March 31, 2026 04:12
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