@arc-js/meta 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/components.jsx CHANGED
@@ -1,7 +1,16 @@
1
1
  import React from "react";
2
2
  import { useEffect } from 'react';
3
- import { setHeader } from './utils'
3
+ import { setHeader } from './utils';
4
+ import { useConfig } from '@arc-js/config-manager/hooks/useConfig';
5
+ import { useTranslation } from '@arc-js/intl/hooks/useTranslation'
6
+
4
7
  function Metadata(params) {
8
+ const {
9
+ isLoading
10
+ } = useConfig();
11
+ const {
12
+ currentLocale
13
+ } = useTranslation();
5
14
  useEffect(() => {
6
15
  setHeader({
7
16
  title: params.title,
@@ -9,7 +18,15 @@ function Metadata(params) {
9
18
  keywords: params.keywords,
10
19
  author: params.author
11
20
  });
12
- }, [])
21
+ }, []);
22
+ useEffect(() => {
23
+ setHeader({
24
+ title: params.title,
25
+ description: params.description,
26
+ keywords: params.keywords,
27
+ author: params.author
28
+ });
29
+ }, [isLoading, currentLocale]);
13
30
  return React.createElement(React.Fragment, null);
14
31
  }
15
32
  export default Metadata;
package/components.tsx CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  import { useEffect } from 'react';
3
3
  import { setHeader } from './utils';
4
-
5
-
4
+ import { useConfig } from '@arc-js/config-manager/hooks/useConfig';
5
+ import { useTranslation } from '@arc-js/intl/hooks/useTranslation';
6
6
 
7
7
 
8
8
 
@@ -15,8 +15,8 @@ interface ParamsMetadata {
15
15
 
16
16
 
17
17
  function Metadata(params: ParamsMetadata) {
18
-
19
-
18
+ const { isLoading } = useConfig();
19
+ const { currentLocale } = useTranslation();
20
20
 
21
21
  useEffect(() => {
22
22
  setHeader({
@@ -26,14 +26,14 @@ function Metadata(params: ParamsMetadata) {
26
26
  author: params.author,
27
27
  });
28
28
  }, []);
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
29
+ useEffect(() => {
30
+ setHeader({
31
+ title: params.title,
32
+ description: params.description,
33
+ keywords: params.keywords,
34
+ author: params.author,
35
+ });
36
+ }, [ isLoading, currentLocale ]);
37
37
 
38
38
  return (<></>);
39
39
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.0.6",
6
+ "version": "0.0.7",
7
7
  "description": "META est une bibliothèque React/TypeScript/Javascript légère et performante pour la gestion dynamique des métadonnées HTML (title, description, keywords, author, etc.) dans les applications SPA. Elle permet de mettre à jour les métadonnées de la page de manière déclarative et impérative, avec un support complet de TypeScript, Javascript.",
8
8
  "main": "index.js",
9
9
  "keywords": [],