Skip to content

Commit

Permalink
fixed problematic variable initializations
Browse files Browse the repository at this point in the history
  • Loading branch information
raffazizzi committed Dec 3, 2024
1 parent 06a3cd3 commit 1f4377a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/reducers/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export function oddClasses(state, action) {
}
}

let localClass = undefined
let customClass = undefined
switch (action.type) {
case UPDATE_CLASS_DOCS:
allCustomClasses.forEach(m => {
Expand All @@ -80,7 +82,7 @@ export function oddClasses(state, action) {
})
return newState
case DELETE_CLASS_DOCS:
let localClass = allLocalClasses.filter(m => action.member === m.ident)[0]
localClass = allLocalClasses.filter(m => action.member === m.ident)[0]
allCustomClasses.forEach(m => {
if (m.ident === action.member) {
if (Array.isArray(m[action.docEl]) && action.index !== undefined) {
Expand Down Expand Up @@ -207,7 +209,7 @@ export function oddClasses(state, action) {
})
return newState
case CHANGE_CLASS_ATTRIBUTE:
let customClass = customization.classes.attributes.filter(c => (c.ident === action.className))[0]
customClass = customization.classes.attributes.filter(c => (c.ident === action.className))[0]
customClass.attributes = customClass.attributes.map(a => {
if (a.ident === action.attName) {
return Object.assign({}, a, {mode: 'change', changed: false, _changedOnMember: true})
Expand Down
8 changes: 5 additions & 3 deletions src/reducers/elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export function oddElements(state, action) {
}
}

let localClass = undefined
let customClass = undefined
switch (action.type) {
case UPDATE_ELEMENT_DOCS:
customization.elements.forEach(m => {
Expand Down Expand Up @@ -277,7 +279,7 @@ export function oddElements(state, action) {
}
}
})
let localClass = localsource.classes.attributes.filter(c => (c.ident === action.className))[0]
localClass = localsource.classes.attributes.filter(c => (c.ident === action.className))[0]
if (customization.classes.attributes.filter(c => (c.ident === action.className)).length === 0) {
customization.classes.attributes.push(localClass)
}
Expand Down Expand Up @@ -330,7 +332,7 @@ export function oddElements(state, action) {
markChange(m, 'attClasses')
} else {
// The class must be inherited, so remove all the attributes instead
const customClass = customization.classes.attributes.filter(c => (c.ident === action.className))[0]
customClass = customization.classes.attributes.filter(c => (c.ident === action.className))[0]
if (customClass) {
for (const clAtt of customClass.attributes) {
deleteAttribute(m, clAtt)
Expand Down Expand Up @@ -380,7 +382,7 @@ export function oddElements(state, action) {
})
return newState
case DELETE_CLASS_ATTRIBUTE_ON_ELEMENT:
let customClass = customization.classes.attributes.filter(c => (c.ident === action.className))[0]
customClass = customization.classes.attributes.filter(c => (c.ident === action.className))[0]
let attribute
if (customClass) {
attribute = customClass.attributes.filter(a => a.ident === action.attName)[0]
Expand Down
1 change: 1 addition & 0 deletions src/reducers/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export function oddModules(state, action) {
}
return Object.assign(state, {customization: customizationObj})
case INCLUDE_CLASSES:
console.log(localsource)
for (const cl of action.classes) {
const localCl = getClassByIdent(localsource, cl, action.classType)
const newCl = clone(localCl)
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/odd/processAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ function createAttribute(attList, att, odd) {

function changeAttr(att, localAtt, attDef, odd) {
for (const whatChanged of att._changed) {
let comparison = null
switch (whatChanged) {
case 'desc':
case 'altIdent':
processDocEls(attDef, att, localAtt, whatChanged, odd)
break
case 'usage':
case 'ns':
let comparison = null
if (localAtt) {
comparison = localAtt[whatChanged]
}
Expand Down

0 comments on commit 1f4377a

Please sign in to comment.