POC (do not merge): opt-in deferred data-element evaluation for #125#205
Draft
ZayanKhan-12 wants to merge 1 commit into
Draft
POC (do not merge): opt-in deferred data-element evaluation for #125#205ZayanKhan-12 wants to merge 1 commit into
ZayanKhan-12 wants to merge 1 commit into
Conversation
Proof-of-concept (NOT merge-ready) exploring the adobe#125 request that dynamic data elements be evaluated when an action fires, not when the configuring module runs. A token prefixed with "~" (e.g. %~myDataElement%) opts out of eager evaluation: turbine strips one "~" and emits the still-unresolved %myDataElement%, which the delegate module can resolve later via turbine.replaceTokens at the real action-time. Normal tokens are unaffected. Adds unit tests and POC-issue-125.md documenting the approach and its limitations (needs component-level settings + extension cooperation + a maintainer design decision). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to my comment on #125 (#125 (comment)). This makes that proposal concrete so it's easy to look at and react to.
Problem (#125)
Turbine resolves
%data element%tokens eagerly, when a delegate module runs (createExecuteDelegateModule.js→replaceTokens(moduleSettings); alsocreateGetExtensionSettings.js). A dynamic data element used in extension/component configuration is therefore frozen to the value it had when that module first ran — not when the action (e.g. an Analytics beacon) actually fires.Change
A token can opt out of eager evaluation by prefixing its name with
~:%foo%%~foo%%foo%(one~stripped)The delegate module receives the literal
%foo%and resolves it itself, at action-time, viaturbine.replaceTokens(...). Because a second pass over%foo%resolves normally, "defer once, resolve later" composes cleanly. Adds unit tests increateReplaceTokens.test.jsand aPOC-issue-125.mdwrite-up.Verified locally against the real module:
Why this is a draft, not a finished feature
~marker is provisional. Discuss: Data Elements' runtime evaluation cannot handle dynamic data element values #125 really asks for a component-level "evaluate at runtime" setting, which extensions don't currently have — the escape syntax (and data-element names that legitimately start with~) needs a design decision.turbine.replaceTokensat action-time on the fields they want to defer; turbine can't do that on their behalf.Opening as a draft purely so the mechanism is concrete for the #125 discussion — happy to change the approach, swap the marker, or close it if you'd rather keep the design in the issue. Direction is your call.