In the end it seems it was some completely unrelated function messing with it.
I just went through the project commenting out anything to do with local storage.
Since I deleted that function it triggers as expected. I don't fully understand but at least its working.:)