Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify "Data Context" in Amphora Locals #608

Open
yuliyv opened this issue Sep 26, 2018 · 0 comments
Open

Identify "Data Context" in Amphora Locals #608

yuliyv opened this issue Sep 26, 2018 · 0 comments

Comments

@yuliyv
Copy link

yuliyv commented Sep 26, 2018

Currently the locals parameter passed to component render hooks looks something like this:

{
  "user": {  },
  "url": "SITE_PREFIX/YYYY/MM/article-slug.html",
  "site": {  },
  "routes": [ ],
  "components": [],
  "params": {
    "year": "YYYY",
     "month": "MM",
     "name": "article-slug.html"
  },
  "query": {},
  "extension": "html"
}

If we render the exact same component using a different renderer then the data would be almost identical except the url, params, and extension might change. This poses a challenge when we have complex component which need to identify page data that is not available at the component level. The current strategy is to utilize locals.url as a key to uniquely identify the data context for a render, however, since the same component might be rendered on different URLs this is not sufficiently unique to identify the data context for a render event.

To alleviate this issue there should be some attribute into the locals that can consistently determine what the context of our render., a simple example might be that any time we pass through url to the locals we should also pass through pageUri or something else which is unique in Amphora.

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

No branches or pull requests

1 participant