software-mansion / software-mansion/TypeGPU

docs: Figure out what behavior we want for isGPUSupported for SSR

Open
#1,898 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.2k
Forks
122
Avg merge
3d 5h
Merged PRs (30d)
34

Description

const adapter = await navigator.gpu?.requestAdapter();
adapter?.requestDevice().then((device) => device.destroy());

export const isGPUSupported = !!adapter;

This code returns false if the navigator does not have the gpu field at all (for Node >20) but for Node<=20 it will throw an error since navigator is not a thing there. Maybe we should handle this case better to avoid confusion in the future.

Update:
What does this even do?

adapter?.requestDevice().then((device) => device.destroy());

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the TypeScript definition of isGPUSupported and inspect how SSR and Node environments reach it. Compare the navigator behavior described for Node <=20 and Node >20, and clarify the purpose of the requestAdapter/requestDevice sequence. Done means the supported SSR behavior and the intended handling of missing navigator.gpu are explicitly decided.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.