mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-10 02:15:02 +00:00
Carry the New workspace context through portal hosts and the draft's metadata through retry
This commit is contained in:
@@ -66,6 +66,10 @@ export function PluginNewWorkspaceProvider({
|
||||
);
|
||||
}
|
||||
|
||||
export function usePluginNewWorkspaceValue(): PluginNewWorkspace | null {
|
||||
return useContext(PluginNewWorkspaceContext);
|
||||
}
|
||||
|
||||
/** The New workspace setup this item sits in. Call it from a component registered with `addNewWorkspaceItem`. */
|
||||
export function useNewWorkspace(): PluginNewWorkspace {
|
||||
const newWorkspace = useContext(PluginNewWorkspaceContext);
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
usePluginComposersSource,
|
||||
} from "./composer.js";
|
||||
import { PluginClientStateProvider, usePluginClientStateSource } from "./client-state.js";
|
||||
import { PluginNewWorkspaceProvider, usePluginNewWorkspaceValue } from "./new-workspace.js";
|
||||
import { PaseoApiProvider, usePaseoContextValue } from "./paseo-context.js";
|
||||
import { PluginRpcProvider, usePluginRpcContextValue } from "./rpc-context.js";
|
||||
|
||||
@@ -20,6 +21,7 @@ export function usePluginRuntimeContextBridge(): PluginRuntimeContextBridge {
|
||||
const state = usePluginClientStateSource();
|
||||
const composer = usePluginComposerValue();
|
||||
const composers = usePluginComposersSource();
|
||||
const newWorkspace = usePluginNewWorkspaceValue();
|
||||
|
||||
if (!paseo || !rpc) {
|
||||
throw new Error("Plugin UI must run inside a contributed plugin surface");
|
||||
@@ -37,11 +39,18 @@ export function usePluginRuntimeContextBridge(): PluginRuntimeContextBridge {
|
||||
) : (
|
||||
withState
|
||||
);
|
||||
const content = composer ? (
|
||||
<PluginComposerProvider composer={composer}>{withComposers}</PluginComposerProvider>
|
||||
const withNewWorkspace = newWorkspace ? (
|
||||
<PluginNewWorkspaceProvider newWorkspace={newWorkspace}>
|
||||
{withComposers}
|
||||
</PluginNewWorkspaceProvider>
|
||||
) : (
|
||||
withComposers
|
||||
);
|
||||
const content = composer ? (
|
||||
<PluginComposerProvider composer={composer}>{withNewWorkspace}</PluginComposerProvider>
|
||||
) : (
|
||||
withNewWorkspace
|
||||
);
|
||||
return (
|
||||
<PaseoApiProvider paseo={paseo}>
|
||||
<PluginRpcProvider invoke={rpc.invoke} subscribe={rpc.subscribe}>
|
||||
@@ -50,6 +59,6 @@ export function usePluginRuntimeContextBridge(): PluginRuntimeContextBridge {
|
||||
</PaseoApiProvider>
|
||||
);
|
||||
},
|
||||
[composer, composers, paseo, rpc, state, translations],
|
||||
[composer, composers, newWorkspace, paseo, rpc, state, translations],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user