In the last publication on state persistence and rehydration I focused on providing the most lightweight solution possible. When it comes to a problem in programming there are always many considerations to balance though. In this piece I will compare the aforementioned lightest solution with the async store IndexedDB, and highlight some of the scenarios where lighter isn’t necessarily the better.

Photo by Stillness InMotion on Unsplash

Compatibility 🔗

Compatibility-wise both indexedDB and localStorage are largely supported, both sitting around 95–98% usage according to While the browser support is there, it’s still important to be aware of the limitations of these technologies, most notably that FireFox Private…

Selectors are pure functions used for obtaining slices of store state. @ngrx/store provides a few helper functions for optimizing this selection. Selectors provide many features when selecting slices of state:

Portability, Memoization, Composition, Testability, Type Safety

Photo by israel palacio on Unsplash

Being pure functions, selectors don’t need to be enclosed by a class, service, or namespace. As NgRx’s guideline suggests exporting them from a module. For actions a more convenient way to handle cohesion is namespacing, for selectors this might pose problems. Actions are also — or at least should be — pure functions, but it’s key difference that they don’t depend on each other…

Obviously, this topic is not new. When using Angular with NgRx, the need for some state persistence will arise sooner or later. Usually sooner 😅. We want our application to have the same state if the user leaves temporarily, or refreshes the site. The most convenient method to go about it is syncing state changes to localStorage, and syncing the saved state back from localStorage as initialState, a.k.a. rehydrating💧 the state. Of course, there are npm libraries achieving that, but implementing it is also as easy as one function.

Photo by Kate Joie on Unsplash

The function

This might seem a tad weird at first, but this…

Matroid in a nutshell

A matroid is nothing more than a pair of two sets: E (ground set) and I (independent sets), where elements of I are a subset of E, selected by the dependency rules of the matroid. Hence matroid is also a structure that abstracts and generalises the notion of linear independence of vector spaces. In fact, a finite subsets (E /ground) of a vector space can be viewed as matroids with the independent subset (I) being constructed according to the rules of linear independence. …

Photo by John Salvino on Unsplash

Browser security headers have been discussed extensively online. There is a great Pluralsight course on the subject, as well as a complete series of articles here on Medium, just to highlight two of the best resources.

Securing your site has never been more critical, and this entails keeping up with the latest security options. But what does securing a website mean? It means writing modern and secure code and applying server patches regularly, as well as defending against external attacks the server can’t control. That’s where security headers come in. The server sends security headers to the client, and the…

Zsolt Deak

Software Engineer at Betsson

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store