Repository navigation
Finish render hooks for cache hits and hook errors - #447
Conversation
beforeRender, afterRender, and the sync pair already run in the pipeline. Pass Hookified options through the constructor, cache engine output before after-hooks so a hit does not apply them twice, and reject the render when throwOnHookError is set. Co-authored-by: Jared Wray <me@jaredwray.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-authored-by: Jared Wray <me@jaredwray.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #447 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 406 438 +32
Branches 94 102 +8
=========================================
+ Hits 406 438 +32 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c106a1e597
ℹ️ 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".
| } finally { | ||
| if (swallowEmpty) { | ||
| this.off(EctoEvents.error, ignoreHookError); |
There was a problem hiding this comment.
Keep error suppression active for overlapping hook invocations
When two renders overlap on the same Ecto instance without an error listener, the first invocation installs the temporary listener and the second sees it and skips installing its own. If the first finishes while the second is still awaiting an async hook, this cleanup removes their only listener. A subsequent failure in the second hook then escapes through the unhandled error event, rejecting that render despite throwOnHookError being false and the documented continue-rendering behavior. Track active invocations or otherwise ensure that each pending invocation retains error suppression until it finishes.
Useful? React with 👍 / 👎.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix for the
beforeRender,afterRender,beforeRenderSync, andafterRenderSynchooks.Summary
Those four hooks already ran inside
renderandrenderSync. This change makes the documented contract hold:throwOnHookError, are passed through to the base class.afterRender/afterRenderSyncrun on every call, including cache hits, so a suffix or other non-idempotent change is applied once per call.throwOnHookError: true, a hook failure rejectsrenderand throws fromrenderSync. The default still emitserrorand continues, including when noerrorlistener is attached.filePathOutputon the hook context is the path that gets written, so a before-hook can redirect output.renderSynccontinues to skipasynchook handlers.Test plan
pnpm test(Biome plus Vitest coverage)throwOnHookErrorfor both async and sync renders