• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EcrituresNumeriques / stylo / 15836175304

23 Jun 2025 10:08PM UTC coverage: 39.164% (-0.05%) from 39.218%
15836175304

push

github

web-flow
chore: Charge les espaces de travail avec SWR (#1635)

571 of 801 branches covered (71.29%)

Branch coverage included in aggregate %.

4 of 109 new or added lines in 4 files covered. (3.67%)

3 existing lines in 2 files now uncovered.

5615 of 14994 relevant lines covered (37.45%)

2.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/front/src/components/workspace/WorkspaceSelectionItems.jsx
NEW
1
import React, { useCallback } from 'react'
×
2

3
import useFetchData from '../../hooks/graphql.js'
×
NEW
4
import { useWorkspaces } from '../../hooks/workspace.js'
×
5

NEW
6
import Alert from '../molecules/Alert.jsx'
×
NEW
7
import Loading from '../molecules/Loading.jsx'
×
UNCOV
8
import WorkspaceSelectItem from './WorkspaceSelectItem.jsx'
×
9

10
import { getArticleWorkspaces } from './Workspaces.graphql'
×
11

12
/**
13
 * @param {object} props
14
 * @param {string} props.articleId
15
 * @returns {Element}
16
 */
17
export default function WorkspaceSelectionItems({ articleId }) {
×
NEW
18
  const {
×
NEW
19
    workspaces,
×
NEW
20
    isLoading: isLoadingWorkspaces,
×
NEW
21
    error: errorLoadingWorkspace,
×
NEW
22
  } = useWorkspaces()
×
NEW
23
  const {
×
NEW
24
    data,
×
NEW
25
    isLoading: isLoadingArticleWorkspaces,
×
NEW
26
    error: errorLoadingArticleWorkspaces,
×
NEW
27
    mutate,
×
NEW
28
  } = useFetchData(
×
29
    { query: getArticleWorkspaces, variables: { articleId } },
×
30
    {
×
31
      revalidateOnFocus: false,
×
32
      revalidateOnReconnect: false,
×
33
    }
×
34
  )
×
35

NEW
36
  const articleWorkspaces = data?.article?.workspaces || []
×
37
  const handleWorkspaceUpdate = useCallback(() => {
×
38
    mutate()
×
39
  }, [mutate])
×
40

NEW
41
  if (isLoadingWorkspaces || isLoadingArticleWorkspaces) {
×
42
    return <Loading />
×
43
  }
×
44

NEW
45
  if (errorLoadingWorkspace) {
×
NEW
46
    return <Alert message={errorLoadingWorkspace.message} />
×
NEW
47
  }
×
48

NEW
49
  if (errorLoadingArticleWorkspaces) {
×
NEW
50
    return <Alert message={errorLoadingArticleWorkspaces.message} />
×
NEW
51
  }
×
52

53
  return (
×
54
    <>
×
NEW
55
      {workspaces.map((workspace) => (
×
56
        <WorkspaceSelectItem
×
57
          key={workspace._id}
×
58
          id={workspace._id}
×
59
          color={workspace.color}
×
60
          name={workspace.name}
×
61
          articleId={articleId}
×
62
          selected={articleWorkspaces.map((w) => w._id).includes(workspace._id)}
×
63
          onChange={handleWorkspaceUpdate}
×
64
        />
×
65
      ))}
×
66
    </>
×
67
  )
68
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc