forked from 1b-agent/opencadstudio-upstream
fix(plugin): drive headless tasks, invalidate layer cache, and handle cancel event
This commit is contained in:
1 parent
bc6ad1a5fe
commit
270b6102de
10 files changed
+208
-20
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user