Add possible way of updating a component without changing it completely, that is setting id when constructing the object.
Motivation
The generic-content-items (mainly sidekick) were unmounting and then mounting again whenever one did update the extensible areas via setter function, and this caused weird behaviours even harming user experience. One interesting case is when the developer wants to build something like this in the plugin:
useEffect(() => {
pluginApi.setGenericContentItems(
[new GenericContentSidekickArea({
contentFunction: variableContentFunction,
name: variableTitle,
section: 'Section of example',
buttonIcon: 'user',
open: false, // <-- this property is responsible to mount the sidekick menu, but if false, the panel itself will be closed.
// On the other hand, if the property is true, right after the menu has mounted, the panel will open.
})],
);
}, [variableTitle, variableContentFunction]);
What used to happen is:
the left-hand panel mounted not opened yet (correct);
the user open this panel (Correct);
And when the title or the contentFunction changed, the panel closed, because it's defined to be mounted as closed (see first action of this list);
Now, it is possible to send a specific id each time you call the setter function (pluginApi.setGenericContentItems), and with that fixed id the content and even the title can change, but it will not re-mount.
What does this PR do?
Add possible way of updating a component without changing it completely, that is setting
id
when constructing the object.Motivation
The generic-content-items (mainly sidekick) were unmounting and then mounting again whenever one did update the extensible areas via setter function, and this caused weird behaviours even harming user experience. One interesting case is when the developer wants to build something like this in the plugin:
What used to happen is:
Now, it is possible to send a specific id each time you call the setter function (
pluginApi.setGenericContentItems
), and with that fixed id the content and even the title can change, but it will not re-mount.More:
Closely related to PR https://github.com/bigbluebutton/bigbluebutton/pull/21476