Skip to content

Beta 02.10.2020

Compare
Choose a tag to compare
@mpscholten mpscholten released this 02 Oct 17:36
· 3968 commits to master since this release
fdb2030

It's time for the next release of IHP: v20201002 🎉

Major Changes

  • Realtime UI Updates with IHP AutoRefresh: Whenever a INSERT, UPDATE or DELETE happens to the records used by your action IHP will rerun your action on the serverside. When the generated html looks different to the html generated on the initial page load it will send the new html to the browser using the WebSocket connection. Watch a demo on twitter or Learn more in the Auto Refresh documentation.
  • PGNotify Functions: A new module has been added to easily watch for changes inside the database.
  • Fancy Errors Disabled in Production: The IHP error handler that tries to be helpful when something goes wrong is now disabled by default in production.
  • New function: paramList: Similiar to param but returns a list when the input is something like ingredients=milk&ingredients=egg. Useful when working with checkboxes.
  • LIMIT queries: You can now add LIMIT to your sql queries easily when using the query builder:
    topTen <- query @Post 
        |> orderBy #rating
        |> limit 10
        |> fetch
  • Postgres Arrays: We've added support for types such as int[] or text[]. These types are not visible in the web-based dev tools yet, but can be used manually when using a code editor to edit the Schema.sql.
  • New Terminal Command: hash-password: With this new terminal tool you can generate a password hash when setting up the IHP authentication module. It will ask your for the plaintext password and will output the password hash.
  • collectionFetchRelated works with QueryBuilder: Previously collectionFetchRelated was not working with certain relationships. This has been fixed and the below code will now work as expected:
    posts <- query @Post 
        |> fetch
        >>= collectionFetchRelated #comments

Other Changes

- The image upload recipe has been extended to document how the form needs to look when doing image uploads.
- Login error messages are now Invalid credentials
- Generated.Types is imported by default in the empty Layout.hs
- The Contributing documentation now explains how to run the IHP tests
- A bug where the FrontController.hs was generated twice was fixed
- The version of morphdom used by IHP has been updated
- A new textToId function has been added to simplify conversion of text or bytestrings to db ids
- Missing documentation on fetchCount has been added
- New recipe: How to generate a random string
- New function: sqlQueryScalar similiar to sqlQuery but returns a scalar value
- Fixed scripts not working in dev mode
- Fixed awk warning when running make static/prod.js

Updating

To update the IHP version of your project, open default.nix and change the git commit in line 4 to the following:

rev = "c4d2815f064c055cd957389a4df5eab25294dba3";

After that run the following command to update your project:

nix-shell -j auto --cores 0 --run 'make -B .envrc'
make -B build/ihp-lib

Now you can start your project as usual with ./start.


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. Or follow digitally induced on twitter..

📅 The next release is expected to be released on 16.10.2020.

If you haven't looked already, check out the IHP Auto Refresh Demo 🚀