mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-13 17:10:06 +00:00
refactor: rename internal promptId/PromptId to jobId/JobId (#8730)
## Summary Rename all internal TypeScript usage of legacy `promptId`/`PromptId` naming to `jobId`/`JobId` across ~38 files for consistency with the domain model. ## Changes - **What**: Renamed internal variable names, type aliases, function names, class getters, interface fields, and comments from `promptId`/`PromptId` to `jobId`/`JobId`. Wire-protocol field names (`prompt_id` in Zod schemas and `e.detail.prompt_id` accesses) are intentionally preserved since they match the backend API contract. ## Review Focus - All changes are pure renames with no behavioral changes - Wire-protocol fields (`prompt_id`) are deliberately unchanged to maintain backend compatibility - Test fixtures updated to use consistent `job-id` naming ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8730-refactor-rename-internal-promptId-PromptId-to-jobId-JobId-3016d73d3650813ca40ce337f7c5271a) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -31,7 +31,7 @@ const mockWorkflow: ComfyWorkflowJSON = {
|
||||
// Mock job detail response (matches actual /jobs/{id} API response structure)
|
||||
// workflow is nested at: workflow.extra_data.extra_pnginfo.workflow
|
||||
const mockJobDetail = {
|
||||
id: 'test-prompt-id',
|
||||
id: 'test-job-id',
|
||||
status: 'completed' as const,
|
||||
create_time: Date.now(),
|
||||
update_time: Date.now(),
|
||||
@@ -86,7 +86,7 @@ describe('TaskItemImpl.loadWorkflow - workflow fetching', () => {
|
||||
})
|
||||
|
||||
it('should fetch workflow from API for history tasks', async () => {
|
||||
const job = createHistoryJob('test-prompt-id')
|
||||
const job = createHistoryJob('test-job-id')
|
||||
const task = new TaskItemImpl(job)
|
||||
|
||||
vi.spyOn(jobOutputCache, 'getJobDetail').mockResolvedValue(
|
||||
@@ -95,12 +95,12 @@ describe('TaskItemImpl.loadWorkflow - workflow fetching', () => {
|
||||
|
||||
await task.loadWorkflow(mockApp)
|
||||
|
||||
expect(jobOutputCache.getJobDetail).toHaveBeenCalledWith('test-prompt-id')
|
||||
expect(jobOutputCache.getJobDetail).toHaveBeenCalledWith('test-job-id')
|
||||
expect(mockApp.loadGraphData).toHaveBeenCalledWith(mockWorkflow)
|
||||
})
|
||||
|
||||
it('should not load workflow when fetch returns undefined', async () => {
|
||||
const job = createHistoryJob('test-prompt-id')
|
||||
const job = createHistoryJob('test-job-id')
|
||||
const task = new TaskItemImpl(job)
|
||||
|
||||
vi.spyOn(jobOutputCache, 'getJobDetail').mockResolvedValue(undefined)
|
||||
@@ -112,7 +112,7 @@ describe('TaskItemImpl.loadWorkflow - workflow fetching', () => {
|
||||
})
|
||||
|
||||
it('should only fetch for history tasks, not running tasks', async () => {
|
||||
const job = createRunningJob('test-prompt-id')
|
||||
const job = createRunningJob('test-job-id')
|
||||
const runningTask = new TaskItemImpl(job)
|
||||
|
||||
vi.spyOn(jobOutputCache, 'getJobDetail').mockResolvedValue(
|
||||
@@ -126,7 +126,7 @@ describe('TaskItemImpl.loadWorkflow - workflow fetching', () => {
|
||||
})
|
||||
|
||||
it('should handle fetch errors gracefully by returning undefined', async () => {
|
||||
const job = createHistoryJob('test-prompt-id')
|
||||
const job = createHistoryJob('test-job-id')
|
||||
const task = new TaskItemImpl(job)
|
||||
|
||||
vi.spyOn(jobOutputCache, 'getJobDetail').mockResolvedValue(undefined)
|
||||
|
||||
Reference in New Issue
Block a user