guardian / guardian/dotcom-rendering

Improve efficiency of context in islands code

Open
#8,795 0 comments 0 reactions 0 assignees View on GitHub
Team Candidate: WebX
Dominant language
TypeScript
Stars
274
Forks
34
Avg merge
2d 22h
Merged PRs (30d)
121

Description

In the PR to trial using React context for `renderingTarget` #8704, suggestions to improve the efficiency of the islands code were made, which should be looked into.

The same `config` value is being provided to all islands in a rendering request, when a more efficient way to do this might be to share this in a more common place (rather than props for each island) since the data will be the same for each request.

Summary of thread here:

> You could serialise with `JSON.stringify` inside a single script tag with [type `application/json`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type) on the page?

_Originally posted by @mxdvl in https://github.com/guardian/dotcom-rendering/pull/8704#discussion_r1318943012_

> To @mxdvl's suggestion here's an [example](https://github.com/guardian/dotcom-rendering/blob/main/apps-rendering/src/server/page.tsx#L110-L112) I came across recently of using the script tag in `apps-rendering`

_Originally posted by @ioannakok in https://github.com/guardian/dotcom-rendering/pull/8704#discussion_r1319584540_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.