Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add possible way of updating a component without changing it completely #125

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

GuiLeme
Copy link
Collaborator

@GuiLeme GuiLeme commented Oct 18, 2024

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:

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.

More:

Closely related to PR bigbluebutton/bigbluebutton#21476

…tent without updating the ID of the extensible area.
@TiagoJacobs TiagoJacobs merged commit af8b1be into bigbluebutton:main Oct 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants