Earlier quoted context omitted.
Is it though? Depends if you're triggering it six times a year or six times a day. Some companies pride themselves on how often they deploy code to production [1]. And whether your SPA is something like Google Docs where a user could plausibly have the same document open for a week or more. [1] https://blog.newrelic.com/technology/data-culture-survey-res...
I'm not sure if that's a good example. Google Docs automatically saves the document when there's a change, so you won't loose any work if you refresh.
How do most SPAs handle breaking API schema changes?
21–30 of 39 posts
Re: How do most SPAs handle breaking API schema changes?
#22Ideally, version your APIs, though for some internal APIs you definitely want to be able to make changes without bumping versions constantly. Be backwards and forward compatible as much as possible. Rolling deployments and other factors virtually guarantee mismatched versions in both directions. Many things, like adding new fields or removing old ones, can be staged in such a way that nothing breaks. Protobuf/gRPC of…
Re: How do most SPAs handle breaking API schema changes?
#23I use grpc-web and protocol buffers. Renaming fields doesn't matter -- if the client and server disagree about the name of a key, it doesn't matter, because the transport layer uses the tag number, not the name. (Compare this to JSON, where changing the name does break clients.) Adding fields also doesn't matter, but this is where it starts to get tricky. If a client sends a request without a field that the server ex…
Re: How do most SPAs handle breaking API schema changes?
#24Ideally, version your APIs, though for some internal APIs you definitely want to be able to make changes without bumping versions constantly. Be backwards and forward compatible as much as possible. Rolling deployments and other factors virtually guarantee mismatched versions in both directions. Many things, like adding new fields or removing old ones, can be staged in such a way that nothing breaks. Protobuf/gRPC of…
Not sure if this is standard, but what I usually do is bump the version only on a breaking change. So if I add a field, nothing new happens. Remove a field, or fundumentally change the output, then I bump it up.
Re: How do most SPAs handle breaking API schema changes?
#25Re: How do most SPAs handle breaking API schema changes?
#26Re: How do most SPAs handle breaking API schema changes?
#27How do you even handle SPA updates themselves? Apps may reference static resources (JavaScript, CSS, images) which get updated with a new version. Those resources could be clobbered by a deploy, or be uglified, or be versioned. Do you keep the old static resources in place forever, or for a period of time? Or force a reload? Or do you just let clients break and make users reload?
I think people additionally assume this never happens, because their error reporting code lives in the javascript bundle and they never get error reports ;)
The correct solution is probably to keep a few old versions of the Javascript bundle around, so that in-flight requests succeed even as you update the container hosting the app. I do not know of a tool that does this, but the edge case I describe above worries me, so I might write one someday.
Re: How do most SPAs handle breaking API schema changes?
#28Earlier quoted context omitted.
Is it though? Depends if you're triggering it six times a year or six times a day. Some companies pride themselves on how often they deploy code to production [1]. And whether your SPA is something like Google Docs where a user could plausibly have the same document open for a week or more. [1] https://blog.newrelic.com/technology/data-culture-survey-res...
Is it common to be releasing breaking API schema changes 6 times a day?
Re: How do most SPAs handle breaking API schema changes?
#29Re: How do most SPAs handle breaking API schema changes?
#30> A number of responses say "have the client detect that it's running an old version and force reload." That works, but it's pretty annoying UX. Is it though? Of all reasons to force refresh, this sounds reasonable to me as it won't even happen that often. Heck, I would want to refresh if I knew a new version was available.
Is it though? Depends if you're triggering it six times a year or six times a day. Some companies pride themselves on how often they deploy code to production [1]. And whether your SPA is something like Google Docs where a user could plausibly have the same document open for a week or more. [1] https://blog.newrelic.com/technology/data-culture-survey-res...
silent download and auto install on next startup