Dynamic Navmesh Implementation

Hey guys, I am working on a city-building game. The user can move around buildings and also create new ones. But the thing is, each time they do so, I have to regenerate my navmesh so that the citizens of the city won’t go through the buildings. As you know, recreating the navmesh is an expensive operation, so I was wondering how to I should solve this problem. I thought about using a worker thread, but I think it is not possible because worker threads do not have access to the DOM object. I am currently planning on using ajax but I decided to ask the pros first (that’s you) because I have little experience in game dev.
How would you solve this problem, how would you implement a dynamic navmesh?

Did a quick and dirty test using a worker:


Wow man, I am really grateful, thank you so much <33