tiny-pilot / tiny-pilot/tinypilot

Refactor code structure in `app.js`

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

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
3.5k
Forks
291
PR merge metrics
No merged PRs in 30d

Description

Our app.js file has grown quite a bit over time, and I think the internal code structure has become continuously harder to work with. For example:

  • The high-level structure could be clearer and more expressive: in which order do we do things? Can we e.g. group things better, so that it’s clear what belongs together and what doesn’t?
  • We have some redundancies, especially around looking up elements by id (getElementById). For our web components, we usually do this look up once, and then share it via a this._elements field.
  • There are some function definitions in the first half of the file. Would we be able to split them out into one or more separate files, to make the file more concise overall?

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 reading app/static/js/app.js and map its high-level sections, function definitions, and repeated getElementById lookups. Compare the existing web-component pattern using this._elements, then propose a clearer structure and file split while preserving current behavior. Done means the refactoring scope is agreed and app.js is easier to navigate without changing functionality.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.