v0.18.0 (Beta 25.01.2022)
A new IHP release, mostly containing bug fixes and productivty improvements to existing features π οΈ
IHP is a modern batteries-included haskell web framework, built on top of Haskell and Nix. Blazing fast, secure, easy to refactor and the best developer experience with everything you need - from prototype to production.
Major Changes
-
πͺStripe Cancelations are Supported now:
The IHP Stripe Integration now supports two further events that allow your app to automatically handle with unsubscribes:on CustomerSubscriptionUpdated { subscription = stripeSubscription } = do -- ... on CustomerSubscriptionDeleted { subscriptionId } = do -- ...
-
π§° Haskell Language Server: Performance Improvements
The Haskell Language Server provided by IHP is now compiled with the--enable-executable-dynamic
flag. This flag significantly improved performance of using HLS in IHP code bases as reported by multiple people.If you still have performance issues, please submit issues directly here haskell/haskell-language-server#2340
-
πͺ Cookies:
While IHP had supported session cookies for a long time now, we never got to add a simple function to add your own non-session cookies. Now it's finally there, meetsetCookie
:import Web.Cookie action MyAction = do setCookie defaultSetCookie { setCookieName = "exampleCookie" , setCookieValue = "exampleValue" }
-
π Multi-line Strings:
IHP apps now have[trimming|some text|]
in scope by default. Thistrimming
quasi quoter provides a useful way to write multi line strings, like this:let myString = [trimming| My multi line string |]
It's called trimming because the function automatically trims/removes the indentation spaces at the left. So the above string is
My\nmulti line\nstring
instead of<4 spaces>My\n<4 spaces>multi line\n<4 spaces>\nstring
. -
π« Mail Improvements:
You can now easily set reply-to, cc, bcc or custom headers when using the IHP Mailer system:instance BuildMail ConfirmationMail where subject = "Subject" to ConfirmationMail { .. } = Address { addressName = Just "F L", addressEmail = "[email protected]" } from = "[email protected]" html ConfirmationMail { .. } = [hsx| Hello World |] -- New: replyTo ConfirmationMail { .. } = Just Address { addessName = "Support", addressEmail = "[email protected]" } cc ConfirmationMail { .. } = [ Address { addessName = "Some one", addressEmail = "[email protected]" } ] bcc ConfirmationMail { .. } = [ Address { addessName = "Some one", addressEmail = "[email protected]" } ] -- Custom headers headers ConfirmationMail { .. } = [ ("X-Mailer", "mail4j 2.17.0") , ("In-Reply-To", "<[email protected]>") ]
-
ποΈ
deleteRecordByIds
You can now easier delete records when you only know their ids:let postId :: [Id Post] = ["5280e9a5-3105-45b3-8aea-6a081c596a11", "6761216b-c508-4c88-80fc-66316a1dc88c"] deleteRecordByIds postId
-
π
fetchLatest
There's now a helper to fetch latest record of something:latestUser <- query @User |> fetchLatest -- Previously you had to write query: latestUser <- query @User |> orderByDesc #createdAt |> fetchOneOrNothing
Other Changes
- When an SQL error happens, the SQL query that triggered the error is now shown
- Handle default value changes in migrations
- Handle dropping default values in migrations
- Fixed auto generated migration for a new enum value fails because SQL compiler branch is not implemented
- Mail: add support for replyTo, cc, bcc, and custom heards
- add srcset attribute to HSX parser
- Declare usage of es6 modules in module definition of DataSync to improve support with other JS toolings
- Removed window export in ihp-querybuilder.js as this causes babel to fail
- Re-export DataSync libraries from the main modules
- Renamed ihp-datasync-react.js to just react.js
- Added trimming quasi quoter to IHP.Prelude
- Added support for react 18's suspense feature in DataSync
- Use standard renderPagination in list page for Jobs Dashboard
- Added withRowLevelSecurityDisabled: Executes the given block with the main database role and temporarly sidesteps the row level security policies
- Fixed AutoRefresh crashing when database triggers are set up from the ihp_authenticated role
- Support types besides strings in DataSync's filterWhere
- Fixed URL not updating after form submission when the form is submitted as a GET request
- Fixed data editor errors when trying to edit the schema_migrations table
- Normalize table constraints before making diff for auto generated migrations
- Fixed parsing issue when dealing with functional calls with multiple arguments
- Fixed unchecking "Run Migration after Generate" not working
- Updated session docs
- Fixed deleting a table in the schema designer not deleting the table's policies, rls statements, indices
- Fixed PGListener breaking live reload because it's not stopping on cancel
- refactored job runner system to run more reliable in dev mode
- Added support for sql triggers
- Tailwind 3 support
- Fixed Schema Parser not accepting 'CREATE SEQUENCE public.a'
- Parser supports more variants of CREATE SEQUENCE statements now
- Fixed migrations not normalising SERIAL and BIGSERIAL columns
- Fixed space in generated code
- add postgres polygon support
- Support signed integers and floats in the Schema SQL parser. Fixes #1309
- Fixed Migration generator not normalizing index expressions
- Fixed migration generator detecting a difference between custom sql functions when the difference is only CREATE / CREATE OR REPLACE
- Added support for Double/Float64 in DataSync. Fixes #1298
- Support lowercased SELECT expressions
- Improved error message when invalid expression is passed to policy modal
- Fixed livereload always expect the livereload websocket to run at :8001, even when the app itself doesn't even run on :8000
- Fixed migration generator not normalizing policies enough
- Fixed leaking db connections in tests
- Fixed test runs not closing log file handles
- Use utf8 as the default encoding for file handles and stdout
- implement paginatedSqlQuery and paginatedSqlQueryWithOptions
- Added fetchLatest and fetchLatestBy
- Added a
setCookie
function - Fixed migration generator not handling implicitly deleted indexes and constraints
- Fixed generation of enum migrations where adding a value fails in the transaction
- Add overflow-x to code in error messages
- Make "Save DB to fixtures" button always visible
- Use Migrate DB instead of Update DB as the suggested action when the DB is out of sync with the schema
- Add to Guide on Using ihp-datasync without a JS bunlder
Full Changelog: v0.17.0...v0.18.0
Feature Voting
Help decide what's coming next to IHP by using the Feature Voting!
Updating
β See the UPGRADE.md for upgrade instructions.
If you have any problems with updating, let us know on the IHP forum.
π§ To stay in the loop, subscribe to the IHP release emails (right at the bottom of the page). Or follow digitally induced on twitter.