message: indexer-common: Simplify setCostModel resolver logic
diff: @@ -77,26 +77,26 @@ export default {
  ? costModel.model
  : model.model
  + // Update the model variables (fall back to current value if unchanged)
  + let variables = update.variables || model.variables
  +
  if (features.injectDai) {
  const oldDai = getVariable(model.variables, 'DAI')
  const newDai = getVariable(update.variables, 'DAI')
  - // Update the model variables (fall back to current value if unchanged)
  - model.variables = update.variables || model.variables
  -
  // Inject the latest DAI value if available
  if (dai.valueReady) {
  - model.variables = setVariable(model.variables, 'DAI', await dai.value())
  + variables = setVariable(variables, 'DAI', await dai.value())
  } else if (newDai === undefined && oldDai !== undefined) {
  // Otherwise preserve the old DAI value if there is one;
  // this ensures it's never dropped
  - model.variables = setVariable(model.variables, 'DAI', oldDai)
  + variables = setVariable(variables, 'DAI', oldDai)
  }
  - } else {
  - // Update the model variables (fall back to current value if unchanged)
  - model.variables = update.variables || model.variables
  }
  + // Apply new variables
  + model.variables = variables
  +
  return (await model.save()).toGraphQL()
  },
  }
  