Smashing my first bug
Tags: devbugsmash
Published: 2021-05-18 23:52:14

### Contribute to open source they said, it's a great way to break into tech they said.  

A lot easier said than done. I have been developing on the modern web for about a year. I used to code all the time back in the early 2000's when vanilla Javascript, HTML, and CSS was the law of the land. Things have changed a lot since then. Just like learning modern web development, getting involved in open source can feel like drinking from a fire hose.

### Open Source Background

I haven't made any meaningful contributions to projects. I helped [Joe Previte](https://github.com/jsjoeio/joeprevite.com/issues/170) with a styling bug on his portfolio, but he already had the solution coded out.

I spent 6 months on a contract for a consulting firm where I got neck deep in a React/Typescript + GraphQL/NodeJS application. That really boosted my confidence in reading others code, and reading **very large** code files. That experience made me feel more prepared to jump into forem's codebase.

### About This Bug

<!-- First, you'll want to share the link to the original issue (bug) you worked on. Change the sample link in the liquid tag below.  -->


{% github https://github.com/forem/forem/issues/12545 %}

There was a console error thrown any time a text editor component was rendered after the first time. So if you visited an article, left and went to a different article then it would say a variable, `subscribeBtn`, had already been declared.

### How I Smashed It

<!-- Then, share the link to your approved PR! Change the sample link in the liquid tag below.  -->


{% github https://github.com/forem/forem/pull/13694 %}


### Reflection

<!-- Overall, what was the experience of smashing this bug like? Did you learn anything new? Was it challenging? If you’re a first-time or newer contributor, what have you learned? What is your next step in open source? etc.  -->

My biggest challenge in contributing to open source is believing in myself. Before asking to be assigned to the bug, I went into the code base and searched out the identifying variable. Once I found it, I had no idea what was going on or what the fix was but I knew it was within my grasp. Before I could think myself out of the challenge, I asked to be assigned.

I'm really glad I signed up for it because I was forced to play around in someone else's code base using a tool I'm not I'm not super familiar with: liquid tags. But my knowledge of javascript and googling powers helped me solve it. 

Someone had declared a variable in Dev's text editor component with `const`. When a user (you) switched pages (to edit a post or comment, or to a new article) the entire bundle was being sent again. Because the original value was declared with `const` the application was throwing an error saying there was already a variable with the name `subscribeBtn` present. 

### Suggestions for DEV Community Bug Smash

<!-- Anything we can improve about our contributor's guide? Any suggestions for our codebase in general or for Bug Smash going forward?  -->

The `bin/startup` command didn't work for me. Couldn't get foreman to run properly. I just ran the three commands in the  that Procfile in separate terminal windows and that worked fine. Never looked into the foreman issue.