Open geeklisted opened 3 years ago
Thanks for the issue. This is interesting. I'm not seeing the behavior you're indicating (i.e., only the initial HTTP request is being sent, but subsequent requests are not), but I am seeing some weirdness. Here's my simple App.js:
import React, { useState } from 'react';
import {SigPlot, HrefLayer} from 'react-sigplot';
function App() {
const [href, setHref] = useState("http://sigplot.lgsinnovations.com/dat/penny.prm");
return (
<div className="App">
<SigPlot height={300} width={900}>
<HrefLayer href={href} />
</SigPlot>
<ul>
<li onClick={() => setHref("http://sigplot.lgsinnovations.com/dat/penny.prm")}>
Penny.prm
</li>
<li onClick={() => setHref("http://sigplot.lgsinnovations.com/dat/sin.tmp")}>
Sin.tmp
</li>
</ul>
</div>
);
}
export default App;
Also, here is my package.json:
{
"name": "sigplot-href-test",
"version": "0.1.0",
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3",
"react-sigplot": "^0.1.11"
},
"scripts": {
"start": "react-scripts start"
},
"eslintConfig": {
"extends": "react-app"
}
}
While I am seeing network requests for each state change:
Here's what the plot looks like afterward:
This is likely due to not handling this.layer
properly. I'll take a look.
Great, will take a look and report back. Thank you.
@geeklisted Let us know if this is still an issue.
When SigPlot uses HrefLayer with a url based on a React state variable, when the variable is first set, SigPlot loads the given URL. On subsequent changes, an HTTP call to reload the new file is never made.