{"id":29120,"date":"2020-06-02T15:44:02","date_gmt":"2020-06-02T19:44:02","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=29120"},"modified":"2021-05-28T20:54:56","modified_gmt":"2021-05-29T00:54:56","slug":"rebuilding-slack-on-the-desktop","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2020\/06\/02\/rebuilding-slack-on-the-desktop\/","title":{"rendered":"Rebuilding Slack on the Desktop"},"content":{"rendered":"<p><a href=\"https:\/\/slack.engineering\/rebuilding-slack-on-the-desktop-308d6fe94ae4\">Mark Christian and Johnny Rodgers<\/a>, writing last year (also: <a href=\"https:\/\/news.ycombinator.com\/item?id=20499200\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/slack.engineering\/rebuilding-slack-on-the-desktop-308d6fe94ae4\"><p>Today, after more than half a decade of hyper-growth, Slack is used by millions of people with larger companies working with more data than we ever could have imagined when we first started. Somewhat predictably, a few internal cracks were starting to show in the desktop client&rsquo;s foundation. Additionally, the technology landscape had shifted away from the tools we chose in late 2012 (jQuery, Signals, and direct DOM manipulation) and toward a paradigm of composable interfaces and clean application abstractions. Despite <a href=\"https:\/\/slack.engineering\/getting-to-slack-faster-with-incremental-boot-ff063c9222e4\">our best efforts to keep things snappy<\/a>, it became clear that some fundamental changes would be required to evolve the desktop app and prepare it for the next wave of product development.<\/p><p>[&#8230;]<\/p><p>However, moving to a multi-workspace architecture was quite the undertaking. We couldn&rsquo;t expect every function call to pass along a workspace ID, and we couldn&rsquo;t just set a global variable saying which workspace was currently visible since plenty of things continue to happen behind the scenes regardless of which workspace the user is currently looking at.<\/p><p>The key to our approach ended up being <a href=\"https:\/\/redux.js.org\/\">Redux<\/a>, which we were already using to manage our data model. With a bit of consideration and the help of the <a href=\"https:\/\/github.com\/reduxjs\/redux-thunk\">redux-thunk<\/a> library, we were able to model virtually everything as actions or queries on a Redux store, allowing Redux to provide a convenient abstraction layer around the concept of individual workspaces. Each workspace would get its own Redux store with everything living within it &mdash; the workspace&rsquo;s data, information about the client&rsquo;s connectivity status, the WebSocket we use for real-time updates &mdash; you name it. This abstraction created a conceptual container around each workspace without having to house that container in its own Electron process, which was what the legacy client did.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/sandofsky\/status\/1153330057307291649\">Ben Sandofsky<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/sandofsky\/status\/1153330057307291649\">\n<p>Rather than write two separate native apps, Slack has now written a cross-platform app four different times.<\/p>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/05\/28\/shrugs-1-0\/\">Shrugs 1.0<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/03\/05\/rewriting-facebook-messenger\/\">Rewriting Facebook Messenger<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/02\/19\/lessons-from-6-software-rewrite-stories\/\">Lessons From 6 Software Rewrite Stories<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Mark Christian and Johnny Rodgers, writing last year (also: Hacker News): Today, after more than half a decade of hyper-growth, Slack is used by millions of people with larger companies working with more data than we ever could have imagined when we first started. Somewhat predictably, a few internal cracks were starting to show in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-06-02T19:44:06Z","apple_news_api_id":"c923509d-47c7-4fc7-b934-b03cb4c07aa2","apple_news_api_modified_at":"2021-05-29T00:54:59Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/AySNQnUfHT8e5NLA8tMB6og","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[1627,32,1666,1500,2074],"class_list":["post-29120","post","type-post","status-publish","format-standard","hentry","category-technology","tag-electron","tag-macapp","tag-macos-10-15","tag-slack","tag-software-rewrite"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/29120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=29120"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/29120\/revisions"}],"predecessor-version":[{"id":29176,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/29120\/revisions\/29176"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=29120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=29120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=29120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}