Skip to content

add-server: Make adding server dynamic [WIP]. #496

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akashnimare
Copy link
Member

Fixes: #488.

This refactors the code for adding and removing the server so that the app doesn't reload when adding/removing a server.

@priyank-p
Copy link
Member

This is getting really close, to be done..., The issue needs to be addressed, is that when adding a server, previous we add them beforehand so we can assume that this.tabs are all sorted and does not have a FunctionalTab now if we add it dynamically there will be if not more than one functional tab for adding an org so we need to filter them out and update the list accordingly which I need to think what we can do.

@zulipbot zulipbot added size: L and removed size: M labels May 22, 2018
@@ -572,6 +600,7 @@ window.onload = () => {
serverManagerView.init();

window.serverManagerView = serverManagerView;
window.FunctionalTab = FunctionalTab;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These here, are just for testing, provides a great way see what happens underneath the hood using dev-tools.

Just leaving a comment so I know to remove them when cleaning up.

This does couple of things, to make this works:

    - First of all we make sure that `this.tabs` in ServerManagerView
      class has correct order of tabs, when we dynamically add a server
      there will be one FunctionTab if not more, which we need to move to
      the end of array. The reasons we need to do that, if because the click
      handlers need to have correct index values. What we do to fix this in `addServer`
      is we filter out all the FunctionalTabs and remove them from this.tabs temporarily
      then add a server, which will have correct index, and shortcut, then we iterate over
      each functional tabs tabs, we updae this.functionTabs to have correct new index, and
      update the webview to also have correct new index in its data-tab-id attribute.

    - When adding a new server, we call webview.init() to make sure it's appended into
      the webview containers.

    - Lastly we just remove the codepath that reloads the app, and then forward the new server
      when its done, parsing using ipcRenderer.
@priyank-p priyank-p force-pushed the dynamic-add-server branch from 9154a16 to 3309f09 Compare May 22, 2018 16:02
@zulipbot
Copy link
Member

Heads up @akashnimare, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

@akashnimare
Copy link
Member Author

@priyankp10 let's spend some time to finish this.

@akashnimare akashnimare force-pushed the master branch 2 times, most recently from abd41fb to 94cbc78 Compare September 24, 2018 11:16
Base automatically changed from master to main January 22, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not reload app while adding/removing a server
3 participants