From 36890b9a32fb241c5c14866e35035e19247ce0cc Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Mon, 9 Sep 2024 12:36:05 -0700 Subject: [PATCH] Show toast after plugin reload --- src-tauri/src/lib.rs | 12 ++++++++++-- src-web/hooks/useActiveWorkspaceChangedToast.tsx | 2 -- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 15ef85f4..69f1813a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -60,7 +60,7 @@ use yaak_plugin_runtime::events::{ CallHttpRequestActionRequest, FilterResponse, FindHttpResponsesResponse, GetHttpRequestActionsResponse, GetHttpRequestByIdResponse, GetTemplateFunctionsResponse, InternalEvent, InternalEventPayload, PluginBootResponse, RenderHttpRequestResponse, - SendHttpRequestResponse, + SendHttpRequestResponse, ShowToastRequest, ToastVariant, }; use yaak_plugin_runtime::handle::PluginHandle; use yaak_templates::{Parser, Tokens}; @@ -2092,7 +2092,7 @@ async fn handle_plugin_event( if plugin.directory != plugin_handle.dir { continue; } - + upsert_plugin( &w, Plugin { @@ -2104,6 +2104,14 @@ async fn handle_plugin_event( .await .unwrap(); } + let toast_event = plugin_handle.build_event_to_send( + &InternalEventPayload::ShowToastRequest(ShowToastRequest { + message: "Plugin Reloaded".to_string(), + variant: ToastVariant::Info, + }), + None, + ); + Box::pin(handle_plugin_event(app_handle, &toast_event, plugin_handle)).await; None } InternalEventPayload::SendHttpRequestRequest(req) => { diff --git a/src-web/hooks/useActiveWorkspaceChangedToast.tsx b/src-web/hooks/useActiveWorkspaceChangedToast.tsx index ac4ebe59..16a8eec9 100644 --- a/src-web/hooks/useActiveWorkspaceChangedToast.tsx +++ b/src-web/hooks/useActiveWorkspaceChangedToast.tsx @@ -17,8 +17,6 @@ export function useActiveWorkspaceChangedToast() { // Don't notify on the first load if (id === null) return; - console.log('HELLO?', activeWorkspace?.id, id, window.location); - toast.show({ id: 'workspace-changed', timeout: 3000,