Joystream / Joystream/hydra

DatabaseManager.get() - return `null` instead of `undefined` on empty result

Open
#503 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement low-prio qn-hydra-board
Dominant language
TypeScript
Stars
50
Forks
43
PR merge metrics
No merged PRs in 30d

Description

At the moment, DatabaseManager.get() function returns undefined when no record is found. This was in line with older TypeORM!s EntityManager that we were using until recently when we introduced a newer TypeORM version in https://github.com/Joystream/hydra/pull/491.

Let's change the return value to null to align the returning value with EntityManager. The null value is a better representation of empty results anyway, plus easier to work with in JS.

After that, we need to update the code in Joystream QN to reflect this change.

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 at the DatabaseManager.get() entry point and review the TypeORM upgrade in pull request #491 to confirm the expected empty-result behavior. Then trace the Joystream QN code mentioned in the issue and update its handling so the change is complete when empty results return null consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.