Markdown Previewer behaving different in production than on local environment [solved]

I’m having an odd issue with my Markdown Previewer. I have a line of code that should remove HTML from the input. It works fine on my local test environment, but the deployed version does not remove the HTML. I have included the code for the component below. Am I missing something here? The line that should remove the HTML is textInput = textInput.replace(/(<([^>]+)>)/ig,"");

import React, { Component } from 'react';

class MarkdownInput extends Component {
constructor(props) {
	super(props);

	this.state = {
		textInput: ''
	}

}

render() {

	
	return (
		<div className="col-md-6">
		Input
		<textarea 
		value={this.state.textInput}
		onChange={event => this.handleChange(event.target.value)} />
		</div>

	);
	
};

handleChange(textInput) {
	textInput = textInput.replace(/(<([^>]+)>)/ig,"");
	this.setState({textInput});
	if(this.props.onChange) {
		this.props.onChange(textInput);
	}
}



}

export default MarkdownInput;

In my test environment, as soon as the closing > is inputed the HTML is stripped out from the input area. In the live version, it is left in and processed by the preview component.

I figured out what is happening. It’s not my code that is the issue. I didn’t initially account for this when I deployed the app. I made the changes to the component after it was live and then pushed the updated component to github. The problem is that the component itself is not what is being used for the site, but actually the bundle.js file. I did not rebuild bundle.js and push it, so it is still running the old code. (not sure if that made sense). Anyway, I am pretty sure once I rebuild bundle.js and push it, it should solve the problem.

1 Like