Closed benloh closed 4 weeks ago
The conversion was relatively straightforward. There were basically three main hiccups:
UDATA.NewDataLink(this)
UDATA.NewDataLink(this)
breaks because of vestigial requirejs use in client-datalink-class.js
.
This is easily worked around with:
/// Initialize UNISYS DATA LINK for functional react component
const UDATAOwner = { name: 'URCommentThread' };
const UDATA = UNISYS.NewDataLink(UDATAOwner);
For conversation, see slack
forceUpdate
is no longer validReact no longer supports forceUpdate
. Using a dummy variable can force an update, e.g.:
const [dummy, setDummy] = useState(0); // Dummy state variable to force update
const HandleCOMMENTS_UPDATE = () => {
// This is necessary to force a re-render of the comment summaries
// when the comment collection changes on the net
setDummy(dummy => dummy + 1); // Trigger re-render
};
When setting state updates, we could not use the object spread operator. #219 fixes that.
Alternatively, using Object.assign works as well:
setState( prevState => Object.assign({}, ...prevState, { key: newvalue }));
@dsriseah Would you mind giving this a once over to make sure my conversion is kosher?
Was this PR turned back into draft recently? I could have sworn that this wasn't available before. I think I already provided the code review of URComment before; is this everything else converted?
Was this PR turned back into draft recently? I could have sworn that this wasn't available before. I think I already provided the code review of URComment before; is this everything else converted?
Sorry I had it labeled as "Draft" but did not click the button to enable draft mode. The review is in place and has been merged into the this branch (thanks)! But I'm still in the process of applying all the review suggestions to the rest of the files. I also found a few places to refine so it'll be a few days before it's all worked out.
Merge AFTER #213!
This converts the first prototype NCComment* class components into a more modern functional component classes. This is the first step towards developing common components that can be used in MEME as well as Net.Create.
All functionality should be the same.