should both white wires be connected for ceiling light?

I replaced a ceiling light and noticed that the old one had 2 white wires connected with the same cap. (There were also black and copper wires.)
Should both white wires be connected to the new fixture? It works with just one connected but an adjacent light (on same circuit) now doesn’t work, even though [...]