Skip to content

Nt 2695 handle optimized entry children visibility during the sdk lifecycle#176

Open
Lotfi Anwar L Arif (Lotfi-Arif) wants to merge 9 commits intomainfrom
NT-2695-handle-optimized-entry-children-visibility-during-the-sdk-lifecycle
Open

Nt 2695 handle optimized entry children visibility during the sdk lifecycle#176
Lotfi Anwar L Arif (Lotfi-Arif) wants to merge 9 commits intomainfrom
NT-2695-handle-optimized-entry-children-visibility-during-the-sdk-lifecycle

Conversation

@Lotfi-Arif
Copy link
Contributor

@Lotfi-Arif Lotfi Anwar L Arif (Lotfi-Arif) commented Mar 13, 2026

PR Summary

  • Enhanced Personalization to safely support consumer-provided content as either:
    • render-prop children ((resolvedEntry) => ReactNode)
    • direct React nodes/elements.
  • Added nesting protection to block OptimizedEntry/Personalization from being nested with the same baseline entry ID.
  • Kept wrapper layout-neutral with display: contents, while allowing semantic wrapper selection via as="div" | "span" (default div).
  • Added loading layout-target element (data-ctfl-loading-layout-target) so fallback UI remains styleable/targetable even when wrapper uses display: contents.
  • Updated lifecycle behavior to be inferred (removed static lifecycleMode API):
    • personalized entries render when canPersonalize === true
    • non-personalized entries render after SDK init state is ready
    • SSR path renders loading invisibly to preserve layout space.
  • Ensured tracking/event behavior does not interfere with host app propagation/default handling.
  • Refactored and split lifecycle tests, updated docs, and removed outdated spec-mode references.

- Update README with render-prop, wrapper element, and layout-neutral
  behavior details.
- Add nesting guard documentation and implementation to block nested
  Personalization with duplicate baseline entry IDs.
- Add lifecycle and nesting tests for Personalization component.
- Refine loading fallback and baseline personalizable logic.
Render a concrete element with `data-ctfl-loading-layout-target` during
loading,
ensuring layout and visibility remain targetable even when using
`display: contents`. Adds tests for block and inline wrapper cases.
- Introduce `lifecycleMode` prop for SPA and hybrid SSR-SPA rendering
- Render invisible loading target during SSR in hybrid mode
- Block nested wrappers with duplicate baseline entry IDs at runtime
- Update docs and tests for new lifecycle behavior
- Baseline content now renders invisibly during SSR or first hydration
  frame.
- Non-personalized entries are no longer gated behind sdkInitialized.
- Tests and documentation updated to reflect new readiness logic.
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