fix(plugin): drive headless tasks, invalidate layer cache, and handle cancel event

This commit is contained in:
yztink committed 2026-09-21 16:29:01 -07:00
1 parent bc6ad1a5fe
commit 270b6102de
10 files changed
+208 -20

No files matched your search

+12 -2
View File
@@ -419,7 +419,12 @@ impl HostApi for PluginHostApi {
fn add_layer(&mut self, config: crate::host::LayerConfig) -> Option<Handle> {
match self.client.request(PluginRequest::AddLayer(config)) {
Ok(PluginResponse::OptHandle(h)) => h,
Ok(PluginResponse::OptHandle(h)) => {
if h.is_some() {
self.document_cache = OnceCell::new();
}
h
}
Ok(other) => {
eprintln!("[plugin] unexpected AddLayer response: {other:?}");
None
@@ -433,7 +438,12 @@ impl HostApi for PluginHostApi {
fn modify_layer(&mut self, config: crate::host::LayerConfig) -> bool {
match self.client.request(PluginRequest::ModifyLayer(config)) {
Ok(PluginResponse::Bool(b)) => b,
Ok(PluginResponse::Bool(b)) => {
if b {
self.document_cache = OnceCell::new();
}
b
}
Ok(other) => {
eprintln!("[plugin] unexpected ModifyLayer response: {other:?}");
false