Skip to content

Commit 8244973

Browse files
author
Guillaume Chau
committed
fix(ui): prompts for config/tasks getting confused
1 parent 05e0dd0 commit 8244973

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

packages/@vue/cli-ui/src/graphql-api/connectors/configurations.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,20 @@ function writeData ({ config, data }, context) {
8888
function getPrompts (id, context) {
8989
const config = findOne(id, context)
9090
if (config) {
91-
if (current.config !== config) {
92-
const data = readData(config, context)
93-
current = {
94-
config,
95-
data
96-
}
97-
const configData = config.onRead({
98-
data
99-
})
100-
prompts.reset()
101-
configData.prompts.forEach(prompts.add)
102-
if (configData.answers) {
103-
prompts.setAnswers(configData.answers)
104-
}
105-
prompts.start()
91+
const data = readData(config, context)
92+
current = {
93+
config,
94+
data
95+
}
96+
const configData = config.onRead({
97+
data
98+
})
99+
prompts.reset()
100+
configData.prompts.forEach(prompts.add)
101+
if (configData.answers) {
102+
prompts.setAnswers(configData.answers)
106103
}
104+
prompts.start()
107105
return prompts.list()
108106
}
109107
return []

packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js

+6-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const { getCommand } = require('../utils/command')
1313
const MAX_LOGS = 2000
1414

1515
const tasks = new Map()
16-
let promptMemoId
1716

1817
function getTasks () {
1918
const file = cwd.get()
@@ -108,18 +107,13 @@ function updateSavedData (data, context) {
108107
function getPrompts (id, context) {
109108
const task = findOne(id, context)
110109
if (task) {
111-
if (promptMemoId !== id) {
112-
promptMemoId = id
113-
114-
prompts.reset()
115-
task.prompts.forEach(prompts.add)
116-
const data = getSavedData(id, context)
117-
if (data) {
118-
prompts.setAnswers(data.answers)
119-
}
120-
prompts.start()
110+
prompts.reset()
111+
task.prompts.forEach(prompts.add)
112+
const data = getSavedData(id, context)
113+
if (data) {
114+
prompts.setAnswers(data.answers)
121115
}
122-
116+
prompts.start()
123117
return prompts.list()
124118
}
125119
}

0 commit comments

Comments
 (0)