Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Tests for Custom Hooks (1/6) #12486

Closed as not planned
Closed as not planned
Assignees
buenos-nachos
Labels
siteArea: frontend dashboard
@buenos-nachos

Description

@buenos-nachos

Split off from#11421
Following@sreya 's lead by splitting up the custom hook issue into more manageable chunks.

I feel like I've done the most custom hook testing out of anybody in the company, so I'm happy to take this chunk, which is likely going to be the most complicated set

Global reusable hooks

Hook nameNeedsComments
useDebouncedFunctionTouch upOne of the first custom hooks tests I ever wrote
useDebouncedValueTouch upOne of the first custom hooks tests I ever wrote
useCustomEventTouch upIn a great spot; some assertions could be simplified
useEffectEventTouch upNot much to it, but it's become ingrained in many parts of the codebase already
useClassNameTestsMy main worry with this hook is that it's adding CSS directly to the HTML from within the render logic (it's using Vanilla Emotion, and not the React-specific flavor that usesuseInsertionEffect). Not sure if that also means that styles can never be cleaned up
useClickableTestsCould probably have some TypeScript type definitions cleaned up too (sorry)
useClickableTableRowRedesign or deletionThis is causing more accessibility problems than it's solving. See#12248
useClipboardTestsEspecially important, since we had a regression around this
usePaginatedQueryRe-reviewMight be good to go; there are a lot of tests for this already. By far the most complicated hook in this group
usePaginationTestsFeels like it's right at the boundary between a custom hook and a utility function; might be better to remove the hook behavior
useSearchParamKeyTestsPreviouslyuseTab; got beefed up and generalized
useTimeTestsHook just got added. Wondering if we could start using it to get rid of (or at least minimize) some of the time-based side effects we're baking directly into render logic...
useWorkspaceBuildLogsTestsUses websockets under the hood – not sure how tough that will be to deal with, considering that MSW apparently hasn't added support yet

Other hooks

I'm also including this other hook with this group, because it's used in a few different spots, and I think updating it could require a bit of in-depth knowledge of React rendering behavior:

Hook nameFilepathNeedsComments
useProxyLatency./src/contexts/useProxyLatencyBug fixes, possible test case touch-upsThere's some test coverage here already, but from my quick review, there are some logic bugs in the hook that need to fixed

And throwing this one simply because it's already done, and I don't know where else to put it:

Hook nameFilepathNeedsComments
useWorkspaceDuplication./src/pages/CreateWorkspacePage/Has testsMight be worth moving this to the hooks folder?

Task list

  • useDebouncedFunction
  • useDebouncedValue
  • useCustomEvent
  • useClassName
  • useClickable
  • useClickableTableRow
  • useClipboard
  • usePagination
  • usePaginatedQuery
  • useSearchParamKey
  • useTime
  • useWorkspaceBuildLogs
  • useProxyLatency
  • useWorkspaceDuplication

Notes

  • I'm going to be a bit busy with Backstage launch until next Friday, so I probably won't be able to start any other hooks until then. People are free to take any of these hooks, but I would appreciate being tagged on the PRs
    • Ben and I were talking the other day about doing taking a week-long breather at some point after launch to do some tests and bug fixes in core (though if we get a bunch of Backstage feedback, that might have to wait)

Metadata

Metadata

Assignees

Labels

siteArea: frontend dashboard

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp