Skip to content

chore: Remove dfinity utils#3663

Merged
sea-snake merged 5 commits intomainfrom
sea-snake/remove-dfinity-utils
Mar 10, 2026
Merged

chore: Remove dfinity utils#3663
sea-snake merged 5 commits intomainfrom
sea-snake/remove-dfinity-utils

Conversation

@sea-snake
Copy link
Contributor

Remove dfinity utils dependency, given that it's only used for nullish checks and a json replacer/reviver in one place.

Changes

  • Remove @dfinity/utils dependency.
  • Rewrite all usages of isNullish and nonNullish to plain JS (based on TS value type being either undefined, null or undefined | null).

Tests

All existing tests should pass as-is.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the direct @dfinity/utils dependency from both the main frontend and the try-ii sub-frontend. The library was only used for isNullish/nonNullish null-check helpers and jsonReplacer/jsonReviver JSON serialization utilities. All usages are replaced with equivalent plain JavaScript comparisons (=== undefined, === null, !== undefined) and an inline re-implementation of jsonReplacer/jsonReviver in writable.store.ts.

Changes:

  • Removes @dfinity/utils from package.json and src/try-ii/.../package.json; replaces all isNullish/nonNullish calls with explicit === undefined / === null / !== undefined comparisons across ~50 files.
  • Inlines jsonReplacer and jsonReviver (handling BigInt, Principal, Uint8Array) into writable.store.ts and updates the test import accordingly.
  • Migrates a few call sites to NonNullable<typeof credential> typed type guards where filter(nonNullish) was previously used as a predicate.

Reviewed changes

Copilot reviewed 73 out of 74 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json / package-lock.json Removes @dfinity/utils as a direct dependency
src/try-ii/.../package.json Removes @dfinity/utils from try-ii sub-project
src/frontend/src/lib/stores/writable.store.ts Inlines jsonReplacer / jsonReviver implementations
src/frontend/src/lib/stores/writable.store.test.ts Updates jsonReplacer import to local path
src/frontend/src/lib/flows/authFlow.svelte.ts Replaces nullish checks; accidentally drops configURL from requestConfig
All other .ts / .svelte files Replaces isNullish/nonNullish with plain JS comparisons

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sea-snake sea-snake enabled auto-merge March 10, 2026 15:05
@sea-snake sea-snake added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit 105dbdc Mar 10, 2026
62 of 63 checks passed
@sea-snake sea-snake deleted the sea-snake/remove-dfinity-utils branch March 10, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants