Skip to content

Commit

Permalink
fix: override default with undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
ddecrulle committed Jun 17, 2024
1 parent 76594b7 commit d000f98
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 108 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules/
/.yarn_home/
/dist/
/public/
206 changes: 100 additions & 106 deletions public/accordion.json
Original file line number Diff line number Diff line change
@@ -1,111 +1,105 @@
{
"cleaning":{

},
"maxPage":"1",
"variables":[
{
"variableType":"COLLECTED",
"name":"NAME",
"values":{
"PREVIOUS":null,
"COLLECTED":null,
"FORCED":null,
"EDITED":null,
"INPUTTED":null
}
}
"cleaning": {},
"maxPage": "1",
"variables": [
{
"variableType": "COLLECTED",
"name": "NAME",
"values": {
"PREVIOUS": null,
"COLLECTED": null,
"FORCED": null,
"EDITED": null,
"INPUTTED": null
}
}
],
"components":[
{
"componentType":"Question",
"id":"idQuestion",
"page":"1",
"label":{
"type":"VTL|MD",
"value":"\"Label de la Question\""
"components": [
{
"componentType": "Question",
"id": "idQuestion",
"page": "1",
"label": {
"type": "VTL|MD",
"value": "\"Label de la Question\""
},
"description": {
"type": "VTL|MD",
"value": "\"Description de la question\""
},
"declarations": [
{
"declarationType": "HELP",
"id": "idQuestion-help1",
"label": {
"type": "VTL|MD",
"value": "\"Label de la déclaration en position : `BEFORE_QUESTION_TEXT`\""
},
"position": "BEFORE_QUESTION_TEXT"
},
"description":{
"type":"VTL|MD",
"value":"\"Description de la question\""
},
"declarations":[
{
"declarationType":"HELP",
"id":"idQuestion-help1",
"label":{
"type":"VTL|MD",
"value":"\"Label de la déclaration en position : `BEFORE_QUESTION_TEXT`\""
},
"position":"BEFORE_QUESTION_TEXT"
},
{
"declarationType":"HELP",
"id":"idQuestion-help3",
"label":{
"type":"VTL|MD",
"value":"\"Label de la déclaration en position en position : `AFTER_QUESTION_TEXT`\""
},
"position":"AFTER_QUESTION_TEXT"
}
],
"components":[
{
"page":"1",
"componentType":"Input",
"bindingDependencies":[
"NAME"
],
"label":{
"value":"\"Label du composant Input\"",
"type":"VTL|MD"
},
"description":{
"value":"\"Description du composant Input\"",
"type":"VTL|MD"
},
"conditionFilter":{
"value":"true",
"type":"VTL"
},
"maxLength":249,
"id":"name",
"response":{
"name":"NAME"
}
}
]
},
{
"componentType":"Accordion",
"items":[
{
"label":{
"value":"\"Pourquoi cette question ?\"",
"type":"VTL|MD"
},
"body":{
"value":"\"Pour en connaître plus sur vous **1984**\"",
"type":"VTL|MD"
}
}
],
"page":"1",
"position":"bottom"
}
{
"declarationType": "HELP",
"id": "idQuestion-help3",
"label": {
"type": "VTL|MD",
"value": "\"Label de la déclaration en position en position : `AFTER_QUESTION_TEXT`\""
},
"position": "AFTER_QUESTION_TEXT"
}
],
"components": [
{
"page": "1",
"componentType": "Input",
"bindingDependencies": ["NAME"],
"label": {
"value": "\"Label du composant Input\"",
"type": "VTL|MD"
},
"description": {
"value": "\"Description du composant Input\"",
"type": "VTL|MD"
},
"conditionFilter": {
"value": "true",
"type": "VTL"
},
"maxLength": 249,
"id": "name",
"response": {
"name": "NAME"
}
}
]
},
{
"componentType": "Accordion",
"items": [
{
"label": {
"value": "\"Pourquoi cette question ?\"",
"type": "VTL|MD"
},
"body": {
"value": "\"Pour en connaître plus sur vous **1984**\"",
"type": "VTL|MD"
}
}
],
"page": "1",
"position": "bottom"
}
],
"pagination":"question",
"resizing":{

},
"label":{
"type":"VTL|MD",
"value":"Test-Dylan"
"pagination": "question",
"resizing": {},
"label": {
"type": "VTL|MD",
"value": "Test-Dylan"
},
"lunaticModelVersion":"2.5.0",
"modele":"TESTDYLAN",
"enoCoreVersion":"2.7.1",
"generatingDate":"06-03-2024 12:46:44",
"missing":false,
"id":"lsvuvtbg"
}
"lunaticModelVersion": "2.5.0",
"modele": "TESTDYLAN",
"enoCoreVersion": "2.7.1",
"generatingDate": "06-03-2024 12:46:44",
"missing": false,
"id": "lsvuvtbg"
}
12 changes: 11 additions & 1 deletion src/shared/metadataStore/metadataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@ export const metadataStore = {
return state
},
updateMetadata(newState: Partial<MetadataStoreType>) {
state = { ...state, ...newState }
const updatedState = Object.keys(newState).reduce(
(acc, key) => {
if (newState[key as keyof MetadataStoreType] !== undefined) {
return { ...acc, [key]: newState[key as keyof MetadataStoreType] }
}
return acc
},
{ ...state }
)

state = updatedState
emitChange()
},
subscribe(listener: () => void): () => void {
Expand Down

0 comments on commit d000f98

Please sign in to comment.