Skip to content

Commit 7699222

Browse files
committed
Reduce steps for users to see the app after entering the IDE
Automatically start compilation for the selected file.
1 parent 906b001 commit 7699222

File tree

1 file changed

+15
-5
lines changed
  • implement/example-apps/elm-editor/src/FrontendWeb

1 file changed

+15
-5
lines changed

implement/example-apps/elm-editor/src/FrontendWeb/Main.elm

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,21 @@ update event stateBefore =
211211
stateBefore |> update (UserInputChangeTextInEditor content)
212212

213213
FrontendWeb.MonacoEditor.CompletedSetupEvent ->
214-
( stateBefore
215-
, stateBefore.fileInEditor
216-
|> Maybe.map (Tuple.second >> setTextInMonacoEditorCmd)
217-
|> Maybe.withDefault Cmd.none
218-
)
214+
case stateBefore.fileInEditor of
215+
Nothing ->
216+
( stateBefore, Cmd.none )
217+
218+
Just fileInEditor ->
219+
let
220+
( state, compileCmd ) =
221+
update UserInputCompile stateBefore
222+
in
223+
( state
224+
, [ fileInEditor |> Tuple.second |> setTextInMonacoEditorCmd
225+
, compileCmd
226+
]
227+
|> Cmd.batch
228+
)
219229

220230
FrontendWeb.MonacoEditor.EditorActionCloseFileEvent ->
221231
( { stateBefore | fileInEditor = Nothing }

0 commit comments

Comments
 (0)