Vietnam's alliance with the Soviet Union put limits on how far China could go. Those limits don't exist in the current situation.
Namely, China invaded a country backed by a superpower with which it had an official treaty, while Ukraine is not officially part of any military alliances with the West. There is no doubt that China's invasion of Vietnam in 1979 was launched first and foremost as a result of Hanoi's alliance with the Soviet Union. China scholars attribute the decision to invade Vietnam to the "Principal enemy theory": that China's policy towards a country is a result of that country's policy towards China's principal enemy. Before the war and Vietnam's invasion of Cambodia, China's leader Deng Xiaoping saw the probability of the Soviet retaliation along China's northern border as one of the most important factors behind the limited scope of the invasion. Russia does not face any immediate threats on its border to the scale China feared in 1979. Russia is supposedly confident that its military partnership with China is strong enough that it can leave its eastern flank exposed and move troops westward for an invasion of Ukraine. Importantly, some netizens in Vietnam have expressed worries that Russia's invasion of Ukraine reminds them of the threat of a potential surprise Chinese invasion should Vietnam seriously consider joining a U.S.-led alliance against China in the future.