amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

I2I: amp-render - a simpler content fetching and rendering component

Open dmanek opened this issue 5 years ago • 3 comments

Summary

We propose amp-render - component that fetches and renders remote or inline JSON data with these features:

  1. render any shape of data (supported by mustache templates)
  2. customizable with JS to enable developers roll out their own features
  3. support layout="container"

Design document

https://docs.google.com/document/d/1V1rqeFmMT5bvM-z0iPR7wonbYtjwAQjMkBhmVDLrY8w/edit?ts=601c2449&pli=1#

Motivation

Currently, AMP developers have amp-list component to fetch and render remote data. While amp-list satisfies various use cases for rendering list data and offers features like infinite scroll and pagination, over time it has become complex to understand, maintain, and document. Plus, as developers have requested new functionality, we have provided new features leading to a slew of new attributes (e.g. single-item) and auxiliary components (e.g. amp-list-load-more). With amp-render we want to give developers the flexibility to render any shape of data, support layout="container" and add new features using JS leading to a simpler interface.

Additional context

Launch tracker

/cc @ampproject/wg-approvers

dmanek avatar Feb 06 '21 00:02 dmanek

Hi @dmanek and any other amp-render contributors.

I was fearing I've been trying to do something that is inherently impossible, but having now seen the template attribute validation issue and newness of amp-render generally, I wonder if I may have found a bug? Or both. Or a.n. other.

I have documented my problem at StackOverflow, but in short the issue is that I am unable to render my dl-containing template in the correct position and size, with a variable number of dt/dd pairs to start with (pre-rendered into the page/template by my backend), and which may or may not return any additional data via the amp-render xhr, based on user permissions.

amp-render either renders in the correct position on the page by forces itself to zero height, leaving the content to spill underneath succeeding elements; or renders at a more correct size but absolutely positioned 0,0 in the viewport.

AaronMLB avatar Jun 25 '21 20:06 AaronMLB

The above issue is being tracked in #35054.

dmanek avatar Jun 29 '21 18:06 dmanek

Code complete. Closing.

dmanek avatar Jun 30 '21 20:06 dmanek