BalusC opened a new pull request, #1034:
URL: https://github.com/apache/myfaces/pull/1034

   ### Problem
   
   A `UIData` or `UIRepeat` nested inside another iterating component loses the 
submitted values of every enclosing row but the last — silently: no conversion, 
no validation, no model update, no message.
   
   Reproduced on a 5×10 grid (outer table over 5 groups, inner over 10 rows, 3 
text inputs per row) by submitting a marker into every input and counting how 
many the response echoes back:
   
   | scenario | before | after |
   |---|--:|--:|
   | `h:dataTable` in `h:dataTable` | 30/150 | **150/150** |
   | `ui:repeat` in `ui:repeat` | 30/150 | **150/150** |
   | composite in `h:dataTable` | 30/150 | **150/150** |
   | flat table (control) | 105/105 | 105/105 |
   
   The 30 that survived were exactly the last outer row.
   
   ### Cause
   
   `6336caf1d` changed the per-row `EditableValueHolder` state map from 
`Map<String, …>` keyed by `getContainerClientId(context)` to `Map<Integer, …>` 
keyed by the bare row index.
   
   A nested iterating component is one instance reused across the enclosing 
rows, so the bare index makes every enclosing row map to the same key. 
`getContainerClientId()` is the clientId plus the current row index, carrying 
both dimensions; the index key kept only one. `_rowDeltaStates` and 
`_rowTransientStates` were never changed and still key on the clientId.
   
   ### Fix
   
   Key `_rowStates` on `getContainerClientId()` again in both components. The 
precollected iteration lists, the positional `EditableValueHolderState` list 
and its deferred allocation are untouched — only the key type and the two key 
expressions change.
   
   **The optimisation is not being asked back.** Measured against current 
`main` with only `UIData`/`UIRepeat` reverted to `6336caf1d^`, on the Mojarra 
`test/perf` suite (Tomcat, 32 scenarios, two alternating rounds):
   
   | | pre-rewrite | this PR | Δ |
   |---|--:|--:|--:|
   | whole suite | 78.23 s | 76.36 s | **−2.4%** |
   | APPLY_REQUEST_VALUES | 3.43 s | 3.09 s | **−10.0%** |
   | UPDATE_MODEL_VALUES | 4.79 s | 4.41 s | **−7.9%** |
   | RESTORE_VIEW | 12.54 s | 12.75 s | +1.7% |
   
   ### Tests
   
   `UIDataTest.testNestedTableRowStateIsScopedPerOuterRow` and 
`UIRepeatTest.testNestedRepeatRowStateIsScopedPerOuterRow`: a 2×2 nested grid, 
a distinct value per cell, iterate away and back, assert each cell kept its 
own. Both fail without the fix (`expected: <v00> but was: <v10>`) and pass with 
it. Full `api` + `impl` suite green, 1651 tests.
   
   ### Notes
   
   - **A backport to `4.1.x` is needed**: `b4a4050f6` carries the same change 
there, so 4.1.x has the same defect. This PR targets `main` only.
   - Neither line has released it — 4.1.3 predates `6336caf1d`, so no MyFaces 
release is affected. 4.0.x is not affected either (still clientId-keyed).
   - Mojarra had the identical defect, fixed the same way in 
eclipse-ee4j/mojarra#5874.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code) (Opus 5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to