@@ -126,8 +126,8 @@ type Msg
126
126
127
127
update : Msg -> Model -> ( Model , Cmd Msg )
128
128
update msg ( { env } as model) =
129
- case msg of
130
- LinkClicked urlRequest ->
129
+ case ( model . route , msg ) of
130
+ ( _ , LinkClicked urlRequest ) ->
131
131
case urlRequest of
132
132
Browser . Internal url ->
133
133
( model, Nav . pushUrl model. navKey ( Url . toString url) )
@@ -137,7 +137,7 @@ update msg ({ env } as model) =
137
137
Browser . External _ ->
138
138
( model, Cmd . none )
139
139
140
- UrlChanged url ->
140
+ ( _ , UrlChanged url ) ->
141
141
let
142
142
route =
143
143
Route . fromUrl env. basePath url
@@ -172,10 +172,10 @@ update msg ({ env } as model) =
172
172
Route . Perspective params ->
173
173
fetchPerspectiveAndCodebaseTree env. perspective { model2 | env = newEnv params }
174
174
175
- ChangePerspective perspective ->
175
+ ( _ , ChangePerspective perspective ) ->
176
176
navigateToPerspective model perspective
177
177
178
- FetchPerspectiveNamespaceDetailsFinished fqn details ->
178
+ ( _ , FetchPerspectiveNamespaceDetailsFinished fqn details ) ->
179
179
let
180
180
perspective =
181
181
case env. perspective of
@@ -194,24 +194,24 @@ update msg ({ env } as model) =
194
194
in
195
195
( { model | env = nextEnv }, Cmd . none )
196
196
197
- Keydown event ->
197
+ ( _ , Keydown event ) ->
198
198
keydown model event
199
199
200
- OpenDefinition ref ->
200
+ ( _ , OpenDefinition ref ) ->
201
201
navigateToDefinition model ref
202
202
203
- ShowModal modal ->
203
+ ( _ , ShowModal modal ) ->
204
204
let
205
205
( appModal, cmd ) =
206
206
AppModal . show modal
207
207
in
208
208
( { model | appModal = appModal }, Cmd . map AppModalMsg cmd )
209
209
210
- ToggleSidebar ->
210
+ ( _ , ToggleSidebar ) ->
211
211
( { model | sidebarToggled = not model. sidebarToggled }, Cmd . none )
212
212
213
213
-- Sub msgs
214
- AppModalMsg amMsg ->
214
+ ( _ , AppModalMsg amMsg ) ->
215
215
let
216
216
( am, amCmd, out ) =
217
217
AppModal . update env amMsg model. appModal
@@ -226,27 +226,34 @@ update msg ({ env } as model) =
226
226
in
227
227
( newModel, Cmd . batch [ Cmd . map AppModalMsg amCmd, cmd ] )
228
228
229
- CatalogMsg cMsg ->
229
+ ( Route . Catalog , CatalogMsg cMsg ) ->
230
230
let
231
231
( catalog, cmd ) =
232
232
Catalog . update cMsg model. catalog
233
233
in
234
234
( { model | catalog = catalog }, Cmd . map CatalogMsg cmd )
235
235
236
- WorkspaceMsg wMsg ->
237
- let
238
- ( workspace, wCmd, outMsg ) =
239
- Workspace . update env wMsg model. workspace
236
+ ( _, WorkspaceMsg wMsg ) ->
237
+ -- TODO: Clean this up, there should be a top level Project route
238
+ -- instead of 2 separate workspace routes (perspective and
239
+ -- definition)
240
+ if model. route /= Route . Catalog then
241
+ let
242
+ ( workspace, wCmd, outMsg ) =
243
+ Workspace . update env wMsg model. workspace
240
244
241
- model2 =
242
- { model | workspace = workspace }
245
+ model2 =
246
+ { model | workspace = workspace }
243
247
244
- ( model3, cmd ) =
245
- handleWorkspaceOutMsg model2 outMsg
246
- in
247
- ( model3, Cmd . batch [ cmd, Cmd . map WorkspaceMsg wCmd ] )
248
+ ( model3, cmd ) =
249
+ handleWorkspaceOutMsg model2 outMsg
250
+ in
251
+ ( model3, Cmd . batch [ cmd, Cmd . map WorkspaceMsg wCmd ] )
252
+
253
+ else
254
+ ( model, Cmd . none )
248
255
249
- PerspectiveLandingMsg rMsg ->
256
+ ( _ , PerspectiveLandingMsg rMsg ) ->
250
257
let
251
258
( perspectiveLanding, outMsg ) =
252
259
PerspectiveLanding . update rMsg model. perspectiveLanding
@@ -264,7 +271,7 @@ update msg ({ env } as model) =
264
271
PerspectiveLanding . None ->
265
272
( model2, Cmd . none )
266
273
267
- CodebaseTreeMsg cMsg ->
274
+ ( _ , CodebaseTreeMsg cMsg ) ->
268
275
let
269
276
( codebaseTree, cCmd, outMsg ) =
270
277
CodebaseTree . update env cMsg model. codebaseTree
@@ -292,13 +299,16 @@ update msg ({ env } as model) =
292
299
in
293
300
( model3, Cmd . batch [ cmd, Cmd . map CodebaseTreeMsg cCmd ] )
294
301
295
- KeyboardShortcutMsg kMsg ->
302
+ ( _ , KeyboardShortcutMsg kMsg ) ->
296
303
let
297
304
( keyboardShortcut, cmd ) =
298
305
KeyboardShortcut . update kMsg model. keyboardShortcut
299
306
in
300
307
( { model | keyboardShortcut = keyboardShortcut }, Cmd . map KeyboardShortcutMsg cmd )
301
308
309
+ _ ->
310
+ ( model, Cmd . none )
311
+
302
312
303
313
304
314
-- UPDATE HELPERS
@@ -392,25 +402,12 @@ keydown model keyboardEvent =
392
402
( { model | sidebarToggled = not model. sidebarToggled }, Cmd . none )
393
403
in
394
404
case shortcut of
395
- KeyboardShortcut . Chord Ctrl ( K _) ->
396
- showFinder model Nothing
397
-
398
- KeyboardShortcut . Chord Meta ( K _) ->
399
- if model. env. operatingSystem == Env . MacOS then
400
- showFinder model Nothing
401
-
402
- else
403
- noOp
404
-
405
405
KeyboardShortcut . Chord Ctrl ( B _) ->
406
406
toggleSidebar
407
407
408
408
KeyboardShortcut . Chord Meta ( B _) ->
409
409
toggleSidebar
410
410
411
- KeyboardShortcut . Sequence _ ForwardSlash ->
412
- showFinder model Nothing
413
-
414
411
KeyboardShortcut . Chord Shift QuestionMark ->
415
412
let
416
413
( am, amCmd ) =
0 commit comments