Skip to content

Commit

Permalink
SSC do not encode nullary constructors to strings with the constructo…
Browse files Browse the repository at this point in the history
…r tag
  • Loading branch information
s0kil committed Jul 27, 2023
1 parent 217c1aa commit 5e3b561
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion IHP/ServerSideComponent/Controller/ComponentsController.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ instance (Component component controller, FromJSON controller) => WSApp (Compone

nextState <- SSC.action currentState theAction
SSC.setState nextState
Left error -> putStrLn (cs error)
Left error -> do
putStrLn "Failed Parsing Server Side Component Message As JSON"
putStrLn (cs actionPayload)
putStrLn (cs error)
2 changes: 1 addition & 1 deletion IHP/ServerSideComponent/ControllerFunctions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ setState state = do
getState :: _ => _
getState = (.state) <$> readIORef ?instanceRef

deriveSSC = Aeson.deriveJSON Aeson.defaultOptions { sumEncoding = defaultTaggedObject { tagFieldName = "action", contentsFieldName = "payload" }}
deriveSSC = Aeson.deriveJSON Aeson.defaultOptions { allNullaryToStringTag = False, sumEncoding = defaultTaggedObject { tagFieldName = "action", contentsFieldName = "payload" }}

0 comments on commit 5e3b561

Please sign in to comment.