qlik-oss / sn-org-chart

Org chart supernova for nebula.js
https://qlik.dev/libraries-and-tools/visualizations/org-chart
MIT License
3 stars 1 forks source link

Remove useState from options #75

Closed Caele closed 2 years ago

Caele commented 4 years ago

The useState part below should not be needed, https://github.com/qlik-oss/sn-org-chart/blob/master/src/index.js#L47

const options = useOptions();
const [opts] = useState(options);
niekvanstaveren commented 4 years ago

Don't we already have that?

Caele commented 4 years ago

I misspelled a bit, what I mean is that we do useState(options) and then never set that state. So we should be able to use options directly instead. Unless there is a specific reason, which from my point of view could only be because of a bug somewhere. Added this as a github issue as it isn't a priority, but didn't want it to get lost. Will look at adding more of these as I find oddities in the code.

niekvanstaveren commented 2 years ago

Fixed in this PR https://github.com/qlik-oss/sn-org-chart/commit/31618de8b68dc74f392294a12547037e270817bd