Skip to content

Bind build time decisions to the view which recorded them - #6191

Merged
BalusC merged 2 commits into
4.0from
issue_6189
Nov 20, 2026
Merged

BalusC merged 2 commits into
4.0from
issue_6189

Conversation

@BalusC

@BalusC BalusC commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #6189

BuildTimeDecisions held one set of decisions per request. Building another view in the same request (e.g. OmniFaces Components.buildView() for a mail template, or plain ViewHandler.createView() + ViewDeclarationLanguage.buildView() in an action) discarded the decisions of the current view. At render, canSkipTransientBuildRefresh() then checked the decisions of the other view and skipped the re-apply, so a dynamic <ui:include src="#{bean.step}"> kept rendering the old include.

Changes:

  • Decisions are kept per UIViewRoot in a request-scoped map, and reproducesBuild(context, view) checks a view against its own decisions only. A view without a recorded build is never skipped. An empty set still allows the skip, so static views keep the gain of Skip the render-time re-apply when the build's decisions still hold #5960.
  • begin/end replace reset, so a nested build resumes the build it interrupted.
  • With com.sun.faces.restoreBuildTimeDecisions enabled, a build of a view other than the view root no longer records into, nor replays from, the saved state of the view root. The view root is taken from the innermost FacesContext, because a FacesContextWrapper such as OmniFaces' TemporaryViewFacesContext returns the temporary view as its view root.

Tests:

  • BuildTimeDecisionsTest: a view is checked against its own decisions only; a view without a recorded build is not reproduced; a nested build resumes the interrupted one; a build of another view is recognized through a wrapper.
  • SavedBuildTimeDecisionsTest: a build of another view neither replays, stops the replay, nor is saved.
  • New IT test/issue6189: the include follows the step after ajax postbacks, with and without building another view in the action. It fails on 4.0 without this fix and passes with it.

The upmerge to 4.1 and 5.0 follows after merge.

🤖 Generated with Claude Opus 5.5

BuildTimeDecisions held one set of decisions per request. Building
another view in the same request, such as a mail template built in an
action via ViewDeclarationLanguage.buildView, discarded the decisions
of the current view. The render-time re-apply was then checked against
the decisions of the other view and skipped, so a dynamic ui:include
kept rendering its old src. Regression of #5960 (56442e4), since
4.0.23.

Keep the decisions per UIViewRoot in a request-scoped map, and check a
view against its own decisions only. A view without a recorded build
is never skipped. A nested build resumes the build it interrupted.

With com.sun.faces.restoreBuildTimeDecisions enabled, a build of a
view other than the view root no longer records into, nor replays
from, the saved state of the view root. The view root is taken from
the innermost FacesContext, because OmniFaces' TemporaryViewFacesContext
returns the temporary view as its view root.

Fixes #6189

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BalusC BalusC added this to the 4.0.31 milestone Nov 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BalusC
BalusC merged commit 3e9a27d into 4.0 Nov 20, 2026
2 checks passed
@BalusC
BalusC deleted the issue_6189 branch November 20, 2026 18:20
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