mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-13 20:53:30 +01:00
[PR #119] [MERGED] Plugin execution context #55
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mountain-loop/yaak/pull/119
Author: @gschier
Created: 10/1/2024
Status: ✅ Merged
Merged: 10/1/2024
Merged by: @gschier
Base:
master← Head:plugin-execution-context📝 Commits (2)
422a581Pass window label through to plugin calls8c106cbBetter window context helpers📊 Changes
29 files changed (+635 additions, -371 deletions)
View changed files
📝
plugin-runtime-types/package.json(+3 -1)📝
plugin-runtime-types/src/bindings/events.ts(+9 -2)➕
plugin-runtime-types/src/bindings/serde_json/JsonValue.ts(+3 -0)📝
plugin-runtime-types/src/plugins/Context.ts(+4 -0)📝
plugin-runtime/src/index.worker.ts(+78 -30)📝
src-tauri/src/http_request.rs(+6 -2)📝
src-tauri/src/lib.rs(+163 -122)📝
src-tauri/src/notifications.rs(+5 -5)📝
src-tauri/src/render.rs(+24 -17)📝
src-tauri/src/template_callback.rs(+26 -18)📝
src-tauri/vendored/plugins/exporter-curl/package.json(+2 -10)📝
src-tauri/vendored/plugins/filter-jsonpath/package.json(+4 -6)📝
src-tauri/vendored/plugins/filter-xpath/package.json(+2 -7)📝
src-tauri/vendored/plugins/importer-curl/package.json(+2 -9)📝
src-tauri/vendored/plugins/importer-insomnia/package.json(+2 -7)📝
src-tauri/vendored/plugins/importer-openapi/package.json(+2 -8)📝
src-tauri/vendored/plugins/importer-postman/package.json(+2 -11)📝
src-tauri/vendored/plugins/importer-yaak/package.json(+2 -10)➕
src-tauri/vendored/plugins/template-function-request/build/index.js(+64 -0)➕
src-tauri/vendored/plugins/template-function-request/package.json(+17 -0)...and 9 more files
📄 Description
It's possible to for a call stack to look something like this:
If a plugin calls
toast.show(), how does it know what window to show it on? The current implementation hacks it by always using the focused window (falling back to the main window if none focused) but this is problematic when plugins trigger requests, for example, because the runtime uses the window to get the current workspace and environment.This PR eliminates the need for this hack by tacking on the initiating window label to every plugin call. This label is then added to every back-and-forth even until the call chain ends. This means the
toast.show()handler can simply get the window from the window label on the given event.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.