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

EcrituresNumeriques / stylo / 13673346615

05 Mar 2025 10:02AM UTC coverage: 28.524% (+0.03%) from 28.496%
13673346615

push

github

web-flow
fix(write): évite le re-rendering dû à la biblio (#1313)

Co-authored-by: Thomas Parisot <thom4parisot@users.noreply.github.com>

402 of 602 branches covered (66.78%)

Branch coverage included in aggregate %.

0 of 32 new or added lines in 2 files covered. (0.0%)

56 existing lines in 5 files now uncovered.

3914 of 14529 relevant lines covered (26.94%)

1.92 hits per line

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

0.0
/front/src/components/TagCreate.jsx
1
import { Button, useInput, useToasts } from '@geist-ui/core'
×
2
import React, { useCallback } from 'react'
×
3
import { useTranslation } from 'react-i18next'
×
4

5
import { randomColor } from '../helpers/colors.js'
×
6
import { useGraphQLClient } from '../helpers/graphQL'
×
7
import { useMutate } from '../hooks/graphql'
×
8
import { createTag, getTags } from './Tag.graphql'
×
9

10
import styles from './TagCreate.module.scss'
×
11
import Field from './Field'
×
12

UNCOV
13
export default function TagCreate() {
×
14
  const { setToast } = useToasts()
×
15
  const { data, mutate } = useMutate({ query: getTags, variables: {} })
×
16
  const { t } = useTranslation()
×
17
  const { state: name, bindings: nameBindings } = useInput('')
×
18
  const { state: description, bindings: descriptionBindings } = useInput('')
×
19
  const { state: color, bindings: colorBindings } = useInput(randomColor())
×
20

UNCOV
21
  const { query } = useGraphQLClient()
×
22

23
  const variables = {
×
UNCOV
24
    name,
×
25
    description,
×
26
    color,
×
27
  }
×
28

29
  const handleCreateTag = useCallback(
×
30
    (event) => {
×
UNCOV
31
      event.preventDefault()
×
32
      ;(async () => {
×
33
        try {
×
34
          const result = await query({
×
35
            query: createTag,
×
36
            variables,
×
37
          })
×
38
          await mutate(
×
39
            {
×
40
              user: {
×
41
                tags: [...data.user.tags, result.createTag],
×
42
              },
×
43
            },
×
44
            { revalidate: false }
×
45
          )
×
46
        } catch (err) {
×
47
          setToast({
×
48
            type: 'error',
×
49
            text: `Unable to create a new tag: ${err.message}`,
×
50
          })
×
51
        }
×
52
      })()
×
53
    },
×
54
    [variables]
×
55
  )
×
56

57
  return (
×
58
    <section className={styles.create}>
×
UNCOV
59
      <form onSubmit={handleCreateTag}>
×
60
        <Field
×
61
          autoFocus={true}
×
62
          label={t('tag.createForm.nameField')}
×
63
          type="text"
×
64
          {...nameBindings}
×
65
        />
×
66
        <Field
×
67
          label={t('tag.createForm.descriptionField')}
×
68
          type="text"
×
69
          {...descriptionBindings}
×
70
        />
×
71
        <Field
×
72
          label={t('tag.createForm.colorField')}
×
73
          type="color"
×
74
          {...colorBindings}
×
75
        />
×
76
        <ul className={styles.actions}>
×
77
          <li>
×
78
            <Button
×
79
              onClick={handleCreateTag}
×
80
              type="secondary"
×
81
              title={t('tag.createForm.buttonTitle')}
×
82
            >
83
              {t('tag.createForm.buttonText')}
×
84
            </Button>
×
UNCOV
85
          </li>
×
86
        </ul>
×
87
      </form>
×
88
    </section>
×
89
  )
90
}
×
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