sveltejs / sveltejs/kit

Warn on unused data

Open
#12,458 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

It's too easy to accidentally send more data from the server than you need. It would be nice if there was an easy way to see what's not being used.

Describe the proposed solution

An approach that would work in 95% of cases is to wrap data in a proxy that tracks which things get accessed during (server or client) render. The other 5% involves non-POJOs and data that's needed after the initial render. For this reason it probably can't be a loud obnoxious warning. I'm not exactly sure where the best place to surface this information would be.

Some years ago I wrote a library called object-cull that does a lot of the heavy lifting. It probably needs a spruce up but could be useful here.

Importance

nice to have

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

The issue names no repository files, entry points, or tests. Start by reviewing the proposed object-cull library and how SvelteKit handles server and client rendering; the work is complete only when the tracking approach and information surface are defined, implemented, and validated without inappropriate warnings for deferred or non-POJO data.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
full-stack, web-dev
Issue type
Feature
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.