RocketChat / RocketChat/Rocket.Chat

Chore: Simplify `getNodeIconType` utility in WebDAV File Picker

Open Beginner friendly
#40,240 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description

Currently, the getNodeIconType utility function in the WebDAV File Picker returns an object containing { icon, type, extension }. However, looking at the codebase and the inline // TODO, this function's callers only ever use the icon property.

Returning the unused type and extension variables adds unnecessary complexity. This issue proposes simplifying the function to directly return the icon name and updating its consumers and unit tests accordingly.

Expected Behavior
  • getNodeIconType.ts returns an IconName string instead of an object.
  • Unused type and extension local variables are removed from the function.
  • WebDAV table and grid components consume the simplified return type.
Actual Behavior
  • The function calculates and returns unused data, and caller components have to destruct the object: const { icon } = getNodeIconType(...)
Context

This was noted as a // TODO in apps/meteor/client/views/room/webdav/WebdavFilePickerModal/lib/getNodeIconType.ts. Cleaning this up will improve code maintainability.

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 with apps/meteor/client/views/room/webdav/WebdavFilePickerModal/lib/getNodeIconType.ts and inspect the WebDAV table and grid consumers. Update the callers and unit tests to use the direct IconName result, and confirm the unused type and extension data are gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.