Cohomology ring of disjoint union

It's a well-known fact that $$H^*(\bigsqcup_{\alpha}X_{\alpha};R)\xrightarrow{\cong}\prod_{\alpha}H^*(X_{\alpha};R)$$ that is also in Hatcher Chapter 3, example 3.13. My attempt by definition is that

$$H^*(\bigsqcup_{\alpha}X_{\alpha};R) = \bigoplus_{k\geq 0}H^k(\bigsqcup_{\alpha}X_{\alpha};R)=\bigoplus_{k\geq 0}\prod_{\alpha}H^k(X_{\alpha};R)$$

and

$$\prod_{\alpha}H^*(X_{\alpha};R)=\prod_{\alpha}\bigoplus_{k\geq 0}H^k(X_{\alpha};R).$$

However, is it true that $$\bigoplus_{k\geq 0}\prod_{\alpha}H^k(X_{\alpha};R)=\prod_{\alpha}\bigoplus_{k\geq 0}H^k(X_{\alpha};R)$$? I remembered from my algebra course that direct sum and direct product can not be interchanged, but I have trouble constructing a good example. Would anyone like to point out my mistake here or a good example for failing to interchange $$\prod$$ and $$\bigoplus$$? If it fails, how could we prove this fact?

• Related: math.stackexchange.com/questions/1003299/… and math.stackexchange.com/questions/4019359/…. Basically, the correct definition is to define the graded ring $H^*$ as just consisting of the sequence of $H^k$'s (together with the relevant operations), rather than their direct sum (or their direct product). Mar 8, 2022 at 4:01
• But, if you define the graded ring $H^*$ as a direct sum the way Hatcher does, then his assertion in Example 3.13 is simply wrong. Mar 8, 2022 at 4:11
• Note that if you take $H^*$ to be a sequence of abelian groups, then it’s not closed under addition, and some people might be hesitant to call such an object a ring. Mar 8, 2022 at 7:49
• I think it doesn't really matter whether we think of the graded ring as a sequence of $H^k$ or their direct sum as long as we understand that product to be taken in the category of graded rings. Mar 9, 2022 at 17:48