Skip to content

Commit 734c012

Browse files
clean up console logs
1 parent a647165 commit 734c012

File tree

3 files changed

+18
-34
lines changed

3 files changed

+18
-34
lines changed

app/src/components/StateManagement/CreateTab/components/TableStateProps.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ const TableStateProps = props => {
8484
}
8585
}
8686
}
87-
console.log({otherId})
8887
dispatch({
8988
type: 'DELETE STATE',
9089
payload: { stateProps: filtered, rowId: selectedId, otherId: otherId.id }

app/src/helperFunctions/generateCode.ts

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -123,25 +123,15 @@ const generateUnformattedCode = (
123123
const elementTagDetails = (childElement: object) => {
124124
let customizationDetails = '';
125125
let passedInPropsString = '';
126-
console.log({childElement})
127126
if (childElement.type === 'Component') {
128127
let childComponent;
129128
for (let i = 0; i < components.length; i++) {
130129
if (childElement.name === components[i].name) {
131130
childComponent = components[i];
132131
}
133132
}
134-
console.log({childComponent})
135-
console.log('childComponent.passedinprops', childComponent.passedInProps)
136-
137-
138-
console.log('past initial length check')
139-
console.log('childComponent.passedInProps.length', childComponent.passedInProps.length);
140-
childComponent.passedInProps.forEach(prop => {passedInPropsString += `${prop.key} = {${prop.key}} `
141-
console.log({prop})
133+
childComponent.passedInProps.forEach(prop => {passedInPropsString += `${prop.key} = {${prop.key}} `
142134
})
143-
144-
console.log({passedInPropsString})
145135
}
146136

147137

@@ -267,7 +257,6 @@ const generateUnformattedCode = (
267257
return `${enrichedChildren
268258
.map((child: any) => {
269259
if (child.type === 'Component') {
270-
console.log({enrichedChildren})
271260
return `<${child.name} ${elementTagDetails(child)}/>`;
272261
} else if (child.type === 'HTML Element') {
273262
return elementGenerator(child, level);
@@ -297,7 +286,6 @@ const generateUnformattedCode = (
297286
for (const element of stateArray) {
298287
stateToRender += levelSpacer(2, 2) + element + ';';
299288
}
300-
console.log({stateToRender})
301289
return stateToRender;
302290
};
303291
const enrichedChildren: any = getEnrichedChildren(currComponent);
@@ -381,27 +369,23 @@ const generateUnformattedCode = (
381369

382370
//return a string with all contexts provider in component's body
383371
const createRender = () => {
384-
console.log('createRender runs')
385372
let result = `${writeNestedElements(enrichedChildren)}`;
386-
console.log({result})
387-
console.log({enrichedChildren})
388373
if (importReactRouter) result = `<Router>\n ${result}\n </Router>`;
389374
if (allContext.length < 1) return result;
390375

391376
if (currComponent.name === 'App') {
392377
allContext.reverse().forEach((el, i) => {
393-
let tabs = `\t\t`;
394-
if (i === allContext.length - 1) {
395-
tabs = `\t\t\t`;
396-
}
397-
result = `${tabs.repeat(allContext.length - i)}<${
398-
el.name
399-
}Provider>\n ${result}\n ${tabs.repeat(allContext.length - i)}</${
400-
el.name
401-
}Provider>`;
378+
let tabs = `\t\t`;
379+
if (i === allContext.length - 1) {
380+
tabs = `\t\t\t`;
381+
}
382+
result = `${tabs.repeat(allContext.length - i)}<${
383+
el.name
384+
}Provider>\n ${result}\n ${tabs.repeat(allContext.length - i)}</${
385+
el.name
386+
}Provider>`;
402387
});
403388
}
404-
console.log('result from createRender', result);
405389
return result;
406390
};
407391

app/src/reducers/componentReducer.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,14 @@ const reducer = (state: State, action: Action) => {
775775
components,
776776
state.canvasFocus.componentId
777777
);
778+
//prevents passing in props more than one time to the current component
779+
for (let i = 0; i < currComponent.passedInProps.length; i++) {
780+
let curr = currComponent.passedInProps[i];
781+
if (curr.id === action.payload.passedInProps.id) {
782+
return { ...state, components};
783+
}
784+
}
785+
778786
//find the parent for deleting instances of where the parent is passing props to children
779787
let parent;
780788
for (let i = 0; i < components.length; i++){
@@ -796,13 +804,6 @@ const reducer = (state: State, action: Action) => {
796804
})
797805

798806

799-
//prevents passing in props more than one time to the current component
800-
for (let i = 0; i < currComponent.passedInProps.length; i++) {
801-
let curr = currComponent.passedInProps[i];
802-
if (curr.id === action.payload.passedInProps.id) {
803-
return { ...state, components};
804-
}
805-
}
806807
// check each components passedInProps property and updating there as well.
807808
currComponent.passedInProps.push(action.payload.passedInProps);
808809

0 commit comments

Comments
 (0)