Skip to content

Moving ApplyContentTransforms from rendering function to mapToModel function #125

@josejibin

Description

@josejibin

We do some transformations to the film/tv/bonus/collection's overview before rendering.
This transformation includes adding the markdown, sanitization, and shortcode rendering.

We are doing this in two places for the same content—one in FilmDataSource and another in FilmIndexDataSource.

I wondered if we could move it into a single place, probably while converting an item into a model after fetching it via API.

Why?

  • We don't have to do the same thing in two places.
  • We are mutating the film data. This holds us back from rendering the templates parallelly. ( a good to have future change)

Question.

If we want to do it in mapToModel, we must load the shortcode templates before. (Which we are already doing, by the way). This will make the API package depends on template loading. We are not using the APIs anywhere other than for template rendering though.

So is this a deal-breaker? Can I submit a PR for the same?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions