Skip to content

[Task](shares): Migrate shares/item.jsx #2053

@hodanoori

Description

@hodanoori

Task Description

Convert ShareItem from a class component to a functional TypeScript component. The component renders a single share table row with polling logic to reload pending shares every 5 seconds, a RuleTooltip inner class component for displaying access rules, and dependency loading for share rules via loadShareRulesOnce. It uses componentDidMount, UNSAFE_componentWillReceiveProps, and componentWillUnmount to manage polling and rule loading lifecycle.

Acceptance Criteria

  • Test file item.test.tsx created with 18 unit tests covering: row rendering, share network display, access rules display, dependency loading (loadShareRulesOnce called on mount), polling starts for pending shares, polling stops when share becomes available, polling cleans up on unmount
  • All tests pass (pnpm vitest run)
  • File renamed to item.tsx with TypeScript interfaces defined for Rule, ShareRulesState, Share, ShareNetwork, and ShareItemProps
  • componentDidMount + UNSAFE_componentWillReceiveProps + componentWillUnmount replaced with useEffect hooks
  • Polling managed via useRef for the interval ID, reacting to share.status
  • startPolling and stopPolling methods converted to inline effect logic
  • Inner RuleTooltip class component converted to a functional component
  • loadShareRulesOnce called in a separate useEffect reacting to share.id
  • No TypeScript errors (pnpm typecheck), no lint errors (pnpm lint)
  • Manual visual testing: share rows render correctly, pending shares poll and update, access rules tooltip displays

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions