Let $X : D \rightarrow Spc$ be a diagram with values in the $\infty$-category of spaces and $I$ some (discrete) set, not necessarily finite. ($D$ can be a 1-category if that makes statements easier, but a general $\infty$-category is fine as well). I am interested in the following question:
What is a practical criterion for checking that the canonical comparison map $$ \text{colim}_D (X^I) \rightarrow (\text{colim}_D X)^I $$ is an equivalence?
The question is inspired by the following Proposition due to Adamek, Koubek, Velebil (see below) for the case of a (1-categorical) diagram with values in Sets:
Proposition 4.5.: A small diagram $X : D \rightarrow Set$ commutes with products of cardinality smaller than $\lambda$ in the above sense iff
- given less than $\lambda$ many elements $(d_i,x_i)$ in the category of elements $\text{Elts}(X)$ of $X$, there exists an object $d$ in $D$ such that each $(d_i,x_i)$ lies in the same component of $\text{Elts}(X)$ as some element of $X(d)$;
- given less than $\lambda$ many pairs $(d, x_i)$ and $(d', x'_i)$ of elements of $X$ such that for each $i$ the pair lies in one component of $\text{Elts}(X)$, there exists a zig-zag $Z$ in $D$ connecting $d$ and $d'$ such that each of the pairs above can be connected by a zig-zag in $\text{Elts}(X)$ whose underlying zig-zag is $Z$.
To give some intuition for this statement: Condition $1$ is precisely surjectivity of the comparison map, and $2$ is precisely injectivity.
My thoughts on the matter: The reason why I assume there should be a generalization to colimits in spaces, is that the usage of the word "zigzag" can be literally thought of as meaning path in the realization of the category of elements $\text{Elts}(X)$, which is a model for the (homotopy) colimit. Also, since $\pi_0$ commutes with both colimits and arbitrary products, a necessary condition is that $\pi_0(X)$ satisfies conditions (1) and (2). I suspect a strengthened requirement of (2) to be needed.
Adámek, Jiří; Koubek, Václav; Velebil, J., A duality between infinitary varieties and algebraic theories., Commentat. Math. Univ. Carol. 41, No. 3, 529-541 (2000). ZBL1035.08004.