adobe / adobe/aem-experimentation

renderDecision: pluggable decision renderer

Open
#70 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
16
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Part of #66

## Problem

Applying a decision is hard-coded to *fetch URL → `innerHTML`* with a fixed `main > div` fallback. Real engines return JSON, content references, or external-CMS ids — none of which fit that single shape, so every integrator re-implements the application seam.

## Proposal

```js
loadEager(document, {
renderDecision: async (el, decision) => { /* apply however the decision is shaped */ },
});
```

Default (unset) keeps the current fetch-and-replace behavior. When provided, the plugin hands the target element + the normalized decision to the integrator (e.g. json2html, external fetch, DOM patch).

## Acceptance criteria

- [ ] `renderDecision` is used to apply the decision when provided.
- [ ] Default behavior (fetch URL → replace) unchanged when unset.
- [ ] Receives the resolved element and the normalized decision object.

Contributor guide

Open the contributing guide

Research direction

Start at the loadEager implementation and trace the current fetch-and-replace path, including how the target element and normalized decision are resolved. Verify that a provided renderDecision receives both values and controls application, while the unset case preserves the existing behavior; run the existing tests and add coverage if the repository has tests for this path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.