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

EcrituresNumeriques / stylo / 13906025440

17 Mar 2025 05:32PM UTC coverage: 31.197% (+0.5%) from 30.662%
13906025440

push

github

web-flow
chore: supprime useMutation et clarifie les fonctions (#1304)

* chore: supprime useMutation et clarifie les fonctions

- Renomme useGraphQL en useFetchData
- Introduit une fonction useMutateData pour mettre à jour les données pour un scope (query + variables)

* fix: articleId destructuring

* chore: ajout de tests sur le hook article

* fix: mise à jour des tags associés à l'article sur la liste des articles

* chore: adapt TagEditForm tests

462 of 677 branches covered (68.24%)

Branch coverage included in aggregate %.

165 of 341 new or added lines in 29 files covered. (48.39%)

9 existing lines in 8 files now uncovered.

4367 of 14802 relevant lines covered (29.5%)

2.21 hits per line

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

0.0
/front/src/components/workspace/WorkspaceSelectionItems.jsx
1
import { Loading } from '@geist-ui/core'
×
2
import React, { useCallback, useMemo } from 'react'
×
3
import PropTypes from 'prop-types'
×
4
import { useSelector } from 'react-redux'
×
5

6
import { getArticleWorkspaces } from './Workspaces.graphql'
×
NEW
7
import useFetchData from '../../hooks/graphql.js'
×
8
import WorkspaceSelectItem from './WorkspaceSelectItem.jsx'
×
9

10
export default function WorkspaceSelectionItems({ articleId }) {
×
11
  const userWorkspaces = useSelector((state) => state.activeUser.workspaces)
×
NEW
12
  const { data, isLoading, mutate } = useFetchData(
×
13
    { query: getArticleWorkspaces, variables: { articleId } },
×
14
    {
×
15
      revalidateOnFocus: false,
×
16
      revalidateOnReconnect: false,
×
17
    }
×
18
  )
×
19

20
  const articleWorkspaces = useMemo(
×
21
    () => data?.article?.workspaces || [],
×
22
    [data]
×
23
  )
×
24

25
  const handleWorkspaceUpdate = useCallback(() => {
×
26
    mutate()
×
27
  }, [mutate])
×
28

29
  if (isLoading) {
×
30
    return <Loading />
×
31
  }
×
32

33
  return (
×
34
    <>
×
35
      {userWorkspaces.map((workspace) => (
×
36
        <WorkspaceSelectItem
×
37
          key={workspace._id}
×
38
          id={workspace._id}
×
39
          color={workspace.color}
×
40
          name={workspace.name}
×
41
          articleId={articleId}
×
42
          selected={articleWorkspaces.map((w) => w._id).includes(workspace._id)}
×
43
          onChange={handleWorkspaceUpdate}
×
44
        />
×
45
      ))}
×
46
    </>
×
47
  )
48
}
×
49

50
WorkspaceSelectionItems.propTypes = {
×
51
  articleId: PropTypes.string,
×
52
}
×
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