amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

I2D: Remove "prerenderSize" viewer param

Open dreamofabear opened this issue 6 years ago • 5 comments

There should only be two usages of prerenderSize -- 0 and 1. However, 0 doesn't work:

https://github.com/ampproject/amphtml/blob/eb3d5f37815f6e5efa5c9b63ca0128cfcc4404fa/src/service/viewer-impl.js#L150-L152

Bug: 0 || 1 == 1

Tried looking for usages of prerenderSize=0 internally and couldn't find any however, so possibly zero impact.

If so, I'd like to remove this param outright. This would simplify IntersectionObserver implementation since rootMargin is not configurable.

  1. Add a dev().expectedError() to find usage of prerenderSize values other than 1.
  2. If negligible, remove code related to prerenderSize.

/cc @ampproject/wg-runtime

dreamofabear avatar Mar 10 '20 01:03 dreamofabear

/cc @dvoytenko @ampproject/wg-viewers

dreamofabear avatar Mar 10 '20 15:03 dreamofabear

To my knowledge only the values of 0 and 1 were intended to be supported. Before removing 0, however, we should see if some viewers are at least attempting to use it. The result of setting this parameter is not observable to them (it's only CPU/bandwidth savings), so they'd not know it's been broken. But the intention matters here.

dvoytenko avatar Mar 10 '20 17:03 dvoytenko

Agreed. Does step (1) above sound reasonable?

Add a dev().expectedError() to find usage of prerenderSize values other than 1.

dreamofabear avatar Mar 10 '20 17:03 dreamofabear

I believe Google Viewer only ever set 1.

ericfs avatar Mar 11 '20 18:03 ericfs

IMHO, we should just go with 0 and 1. We are fully in our power to restrict prerenderSize any way we see fit.

dvoytenko avatar Mar 16 '20 17:03 dvoytenko