Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/library/vue/statefulProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import {
export const useStatefulProcess = <
SomeResult,
>(
tryToPerformFlaggableProcess: () => Promise<SomeResult>,
forciblyPerformFlaggableProcess: () => Promise<SomeResult>,
): ({
try: () => Promise<void>;
initiate: () => Promise<void>;
isInProgress: boolean;
result: SomeResult | null;
}) => {
const flagIsRaised = ref(false);

const capturedResult: Ref<SomeResult | null> = ref(null);

const tryToPerformFlaggedProcess = async (): Promise<void> => {
const forciblyPerformFlaggedProcess = async (): Promise<void> => {
using cleanup = new DisposableStack();
set(flagIsRaised, true);

Expand All @@ -28,12 +28,12 @@ export const useStatefulProcess = <
});

set(capturedResult, null);
const resultOfProcess = await tryToPerformFlaggableProcess();
const resultOfProcess = await forciblyPerformFlaggableProcess();
set(capturedResult, resultOfProcess);
};

return {
try: tryToPerformFlaggedProcess,
initiate: forciblyPerformFlaggedProcess,
get isInProgress() {
return get(flagIsRaised);
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TextToImagePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const imageGeneration = useStatefulProcess(async () => {
<NavigationPanel>
<VForm
:disabled="imageGeneration.isInProgress"
@submit.prevent="imageGeneration.try"
@submit.prevent="imageGeneration.initiate"
>
<TextToImageInputSection
v-model="currentPrompt"
Expand Down