Open keanemind opened 1 year ago
Thank you for your valuable remark, we have updated a lot in our SDK, and have not yet had time to make new examples, I apologize for the confusion.
As for the API, I think that the function should just return the result immediately without a promise, so that the developer can call destroy before everything is loaded, for example, if the user decides to leave the page, we will definitely take this into account in future versions.
I will mark this repository as deprecated so as not to confuse anyone else and leave this issue open.
The main source of information now is the repository https://github.com/PeerBoard/core and our guides in the community https://community.peerboard.com/post/1162435747
It seems the return value of
createForum
is aPromise<ForumAPI>
that should be awaited. Without adding the await,componentWillUnmount
runs into an error becausethis.forum
has the wrong type.https://github.com/PeerBoard/integration-examples/blob/5ed5450d85bb8a2eb37941bce16b5a9428f7fcd2/React/PeerBoard.jsx#L50
While we're at it, since
this.forum
might not exist yet when the component is being unmounted, perhaps thecomponentWillUnmount
implementation should bethis.forum?.destroy();
.