diff --git a/mon-entreprise/cypress/integration/publi.codes/index.js b/mon-entreprise/cypress/integration/publi.codes/index.js
index dc1561dc2..7c376ca87 100644
--- a/mon-entreprise/cypress/integration/publi.codes/index.js
+++ b/mon-entreprise/cypress/integration/publi.codes/index.js
@@ -8,8 +8,7 @@ describe('Navigation', function() {
})
it('bac à sable should work', function() {
cy.contains('Bac à sable').click()
- cy.contains('dépenses primeur')
- cy.contains('Résultats')
+ cy.contains('Dépenses primeur')
cy.contains('11,50')
})
})
diff --git a/mon-entreprise/source/sites/publi.codes/Studio.tsx b/mon-entreprise/source/sites/publi.codes/Studio.tsx
index 6d3e4ce4d..dae8b26f9 100644
--- a/mon-entreprise/source/sites/publi.codes/Studio.tsx
+++ b/mon-entreprise/source/sites/publi.codes/Studio.tsx
@@ -4,7 +4,7 @@ import { invertObj, last } from 'ramda'
import React, { useCallback, useEffect, useMemo, useState } from 'react'
import emoji from 'react-easy-emoji'
import MonacoEditor from 'react-monaco-editor'
-import { useHistory, useLocation } from 'react-router-dom'
+import { useHistory, useLocation, Redirect } from 'react-router-dom'
import styled from 'styled-components'
import yaml from 'yaml'
@@ -55,19 +55,11 @@ export default function Studio() {
const [editorValue, setEditorValue] = useState(initialValue)
const debouncedEditorValue = useDebounce(editorValue, 1000)
- const targets = useMemo(() => {
- try {
- return Object.keys(yaml.parse(debouncedEditorValue) ?? {})
- } catch (e) {
- console.error(e)
- return []
- }
- }, [debouncedEditorValue])
-
const history = useHistory()
useEffect(() => {
history.replace({
pathname,
+ state: { useDefaultValues: true },
search: `?code=${encodeURIComponent(debouncedEditorValue)}`
})
}, [debouncedEditorValue, history])
@@ -96,11 +88,7 @@ export default function Studio() {
{nl2br(this.state.error.message)}
+
+
+ window.location.reload()}>Rafraichir
)
}
diff --git a/mon-entreprise/source/types/app-env.d.ts b/mon-entreprise/source/types/app-env.d.ts
index 4555350e5..9884aa9fd 100644
--- a/mon-entreprise/source/types/app-env.d.ts
+++ b/mon-entreprise/source/types/app-env.d.ts
@@ -2,7 +2,7 @@ declare namespace NodeJS {
interface ProcessEnv {
EN_SITE: string
FR_SITE: string
- NODE_ENV: 'development' | 'production'
+ NODE_ENV: 'development' | 'production' | 'test'
ANALYZE_BUNDLE: '0' | '1'
// Netlify variables
diff --git a/publicodes/source/components/rule/Rule.tsx b/publicodes/source/components/rule/Rule.tsx
index 5e1b0a397..4b1eb7090 100644
--- a/publicodes/source/components/rule/Rule.tsx
+++ b/publicodes/source/components/rule/Rule.tsx
@@ -17,10 +17,13 @@ export default function Rule({
engine,
language
}) {
+ const [viewSource, setViewSource] = useState(false)
+ if (!engine.getParsedRules()[dottedName]) {
+ return
Cette règle est introuvable dans la base
+ } const rule = engine.evaluate(dottedName, { useDefaultValues }) - const [viewSource, setViewSource] = useState(false) const { description, question } = rule return (