Skip to content

Extract ihp-auto-refresh into its own package#2449

Open
mpscholten wants to merge 6 commits intomasterfrom
extract-ihp-auto-refresh
Open

Extract ihp-auto-refresh into its own package#2449
mpscholten wants to merge 6 commits intomasterfrom
extract-ihp-auto-refresh

Conversation

@mpscholten
Copy link
Member

Summary

  • Extracts AutoRefresh (automatic diff-based view re-rendering via WebSocket + PostgreSQL LISTEN/NOTIFY) from the main ihp package into a new ihp-auto-refresh package
  • Makes AutoRefresh an opt-in feature, reducing compilation for apps that don't use it
  • Follows the existing pattern of feature packages like ihp-ssc, ihp-datasync, etc.
  • Removes the hardcoded AutoRefreshWSApp integration from frontControllerToWAIApp, making the router signature simpler

Migration for existing IHP apps

Apps using AutoRefresh will need to:

  1. Add ihp-auto-refresh to build-depends in their .cabal file
  2. Add import IHP.AutoRefresh in controllers using autoRefresh
  3. Add import IHP.AutoRefresh.View in views using autoRefreshMeta
  4. Add webSocketApp @AutoRefreshWSApp to their FrontController instance's controllers list

Test plan

  • Verify ihp compiles without AutoRefresh modules
  • Verify ihp-auto-refresh compiles as standalone package
  • Verify ihp-ide ToolServer compiles without AutoRefresh
  • Run ihp test suite (sans AutoRefresh tests)
  • Run ihp-auto-refresh test suite
  • Test an app using AutoRefresh with the new package

🤖 Generated with Claude Code

AutoRefresh (automatic diff-based view re-rendering via WebSocket + PostgreSQL
LISTEN/NOTIFY) was bundled in the main ihp package. This extracts it into
ihp-auto-refresh, making it an opt-in feature that reduces compilation for apps
that don't use it, following the pattern of ihp-ssc, ihp-datasync, etc.

Key changes:
- Create ihp-auto-refresh/ package with cabal, nix, sources, and tests
- Remove autoRefreshApp type parameter from frontControllerToWAIApp
- Remove AutoRefresh imports from Server.hs, ControllerPrelude, ViewPrelude
- Remove AutoRefresh from ToolServer (IDE doesn't need it)
- Add ihp-auto-refresh to NixSupport/overlay.nix

Apps using AutoRefresh need to:
1. Add ihp-auto-refresh to build-depends
2. Add explicit imports for IHP.AutoRefresh / IHP.AutoRefresh.View
3. Add webSocketApp @AutoRefreshWSApp to FrontController controllers list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a37dbe51f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 24 to 27
(!),
module Data.Data,
module Data.Aeson,
module IHP.AutoRefresh.View,
module IHP.View.Classes,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore autoRefreshMeta export for generated layouts

The app generator still emits View/Layout.hs with {autoRefreshMeta} while importing only IHP.ViewPrelude (see ihp-ide/IHP/IDE/CodeGen/ApplicationGenerator.hs in viewLayoutHs/metaTags), so removing this re-export makes freshly generated apps fail to compile with autoRefreshMeta out of scope unless users patch imports and dependencies by hand. This regresses the default project-generation workflow introduced by new-application scaffolding.

Useful? React with 👍 / 👎.

mpscholten and others added 5 commits February 18, 2026 15:58
…tion

- Add ihp-auto-refresh dependency to ihp-job-dashboard (cabal + nix)
- Add explicit import of IHP.AutoRefresh in Dashboard.hs
- Remove {autoRefreshMeta} from generated app layouts (now opt-in)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ihp-auto-refresh will be a default dependency for new apps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AutoRefresh.hs imports Data.TMap which requires typerep-map.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test-suite had hs-source-dirs: . which caused cabal to treat
library source files as "home modules" of the test suite, leading
to hidden package errors during nix build. Changed to hs-source-dirs:
Test so tests get library modules from the ihp-auto-refresh dependency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Since IHP.ControllerPrelude no longer re-exports autoRefresh,
the test needs to import it explicitly from IHP.AutoRefresh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant