cloudflare / cloudflare/vinext

deployment-id shim: use removeAttribute('data-dpl-id') instead of delete dataset.dplId (old WebKit compat)

Open Beginner friendly
#2,832 0 comments 0 reactions 0 assignees View on GitHub
nextjs-tracking
Dominant language
TypeScript
Stars
8.8k
Forks
406
Avg merge
2d 6h
Merged PRs (30d)
120

Description

## Upstream change

`Fix(deployment-id): prevent exception on old webkit (#94604)` — https://github.com/vercel/next.js/commit/b6d83adac41926e4acabfe21aba12cd5927d62fe (fixes #94601)

In `packages/next/src/shared/lib/deployment-id.ts`, the client-side code reads the deployment id from `document.documentElement.dataset.dplId` and then immediately removes the attribute (it was injected into the HTML only, so React is unaware of it — removing it prevents a hydration mismatch). The removal used `delete document.documentElement.dataset.dplId`, which throws `TypeError: Unable to delete property` on old WebKit (Safari 9, e.g. PlayStation 4 browser) due to how WebKit implemented `dataset`.

Fix: replace

```js
delete document.documentElement.dataset.dplId
```

with

```js
document.documentElement.removeAttribute('data-dpl-id')
```

Same effect, avoids the `delete`-on-dataset throw.

## Why it matters for vinext

vinext ships its own `next/*` shims. If vinext has a deployment-id shim (or any code that reads/strips the `data-dpl-id` attribute at startup to avoid a hydration error), it should use `removeAttribute('data-dpl-id')` rather than `delete ...dataset.dplId` so it doesn't throw on old WebKit engines. This is a small, low-cost parity fix.

Related context: #1538 (deployment id / `NEXT_DEPLOYMENT_ID` in Web Workers) touches the same feature area but is a different concern.

## Action

- Check whether vinext has a deployment-id shim / dataset cleanup at client startup.
- If so, use `removeAttribute('data-dpl-id')` instead of `delete document.documentElement.dataset.dplId`.

## References

- https://github.com/vercel/next.js/commit/b6d83adac41926e4acabfe21aba12cd5927d62fe (#94604, fixes #94601)

Contributor guide

Open the contributing guide

Research direction

Search vinext's client-side Next.js shims for deployment-id handling, `data-dpl-id`, and `dataset.dplId`; compare any match with `packages/next/src/shared/lib/deployment-id.ts`. Confirm whether the startup cleanup exists, use the issue's requested removal behavior if it does, and verify the relevant client startup or hydration tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.