Assalamualaikum

I heard from Yasir Qadhi that if you tell a joke and somebody gets offended you have committed a sin. Is this true or are there different views on this? What if it’s only on the basis that they didn’t understand the joke or take it out of context? Like I may say a racist joke to point out the ignorance of racist people like once I said that some immigrants complain about how other immigrants are taking their jobs. I wasn’t intending to be racist but if someone misunderstood and took it as that would I still be in sin?

Jazzakallahu Khair