Skip to content

Commit

Permalink
allow passing a plain string to provideScopedWorkflowStores
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectronicBlueberry committed Nov 6, 2023
1 parent 523d7ac commit f7a4c04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const errorMessage = ref("");
const { datatypesMapper } = useDatatypesMapper();
const { stateStore } = provideScopedWorkflowStores(ref(props.id));
const { stateStore } = provideScopedWorkflowStores(props.id);
stateStore.setScale(0.75);
Expand Down
8 changes: 6 additions & 2 deletions client/src/composables/workflowStores.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inject, onScopeDispose, provide, type Ref } from "vue";
import { inject, onScopeDispose, provide, type Ref, ref } from "vue";

import { useConnectionStore } from "@/stores/workflowConnectionStore";
import { useWorkflowCommentStore } from "@/stores/workflowEditorCommentStore";
Expand All @@ -15,7 +15,11 @@ import { useWorkflowStepStore } from "@/stores/workflowStepStore";
* @param workflowId the workflow to scope to
* @returns workflow Stores
*/
export function provideScopedWorkflowStores(workflowId: Ref<string>) {
export function provideScopedWorkflowStores(workflowId: Ref<string> | string) {
if (typeof workflowId === "string") {
workflowId = ref(workflowId);
}

provide("workflowId", workflowId);

const connectionStore = useConnectionStore(workflowId.value);
Expand Down

0 comments on commit f7a4c04

Please sign in to comment.