Comfy-Org / Comfy-Org/ComfyUI_frontend

refactor: extract shared useWorkflowSaveGate composable and WorkflowSavePrompt component

Open
#10,461 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

The save-before-proceed flow (`checkNeedsSave`, `handleSave`, `buildWorkflowPath`, name input + save button template) is implemented in multiple locations with near-identical logic:

- `src/platform/workflow/sharing/components/publish/ComfyHubPublishDialog.vue`
- `ShareWorkflowDialogContent.vue` (two tabs)

Future changes to this flow must currently be replicated in all locations, which is error-prone.

## Proposed Solution

- Extract a `useWorkflowSaveGate()` composable encapsulating `checkNeedsSave`, `handleSave`, `buildWorkflowPath`, and related state.
- Create a shared `` component for the name input + save button UI.
- Replace the duplicated implementations in all affected files with the shared composable + component.

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10128
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10128#discussion_r2970254271
- Requested by: @christian-byrne

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10461-refactor-extract-shared-useWorkflowSaveGate-composable-and-WorkflowSavePrompt-compon-32d6d73d36508181b0c0c24ce8a02fbf) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.