function handleLocalCollisions(trace, initialMainKeys) {
  if (trace.length === 0) {
    return trace;
  }
  const componentType = trace[trace.length - 2],
    initialKeysOfType = initialMainKeys[componentType],
    generatedKeyIndex = trace.length - 1;

  if (initialKeysOfType && initialKeysOfType.includes(trace[generatedKeyIndex])) {
    trace[generatedKeyIndex] = createComponentHashedKey(trace[generatedKeyIndex]);
  }
  return trace;
}
Modifies the generated trace if there is a collision with a key that exists in root components object
@param {array} trace The generated trace
@param {object} initialMainKeys the main keys in local components object if it exists
@returns {array} A modified trace if there is any collision with local reusable objects