How to solve the impact of api changes on SPA applications when the front end is released?

The

scenario goes like this: a single-page application with two pages An and B.

the backend changes the API of the B page (for example, the structure of the returned data has changed), and the front end also rewrites the way the B page reads the API. At this time, the backend and the front end release this change at the same time,

but there are always some users who have not exited the page (for example, the user opened page An a long time ago, but when he routed to page B on a single page, he still read API), in the old way. When ajax read API, it reported an error. How can this problem be avoided by publishing?

Apr.03,2021

this should not happen much, unless you have a large number of visits to your application. In this case, you can only consider adding a version of api. When launching the new API, keep the old API

.
Menu