Skip to content

fix: Session resynchronization for embedded webcomponents - #15421

Merged
MarcinVaadin merged 17 commits into
masterfrom
feature/12592-reconnectreload-an-embedded-component-when-the-server-connection-is-lost
Dec 21, 2022
Merged

MarcinVaadin merged 17 commits into
masterfrom
feature/12592-reconnectreload-an-embedded-component-when-the-server-connection-is-lost

Conversation

@MarcinVaadin

@MarcinVaadin MarcinVaadin commented Dec 9, 2022 •

Copy link
Copy Markdown
Contributor

Description

This PR adds session resynchronization and embedded web components reloading in case of session expiration.

Fixes #12592

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@MarcinVaadin

MarcinVaadin commented Dec 9, 2022 •

Copy link
Copy Markdown
Contributor Author

Minor remarks:

  1. Without active server connection component disconnects throws TypeError, so I've defined new empty disconnected function explicitly:
private native void recreateNodes(String elementName)
/*-{
    var elements = document.getElementsByTagName(elementName);
    for (var i = 0 ; i < elements.length ; ++i) {
        var elem = elements[i];
        elem.$server.disconnected = function(){} // mock disconnected callback not to throw TypeError
        elem.parentNode.replaceChild(elem.cloneNode(false), elem);
    }
}-*/;
  1. When reattaching component some client side readonly constants are already present and it was failing, I've commented out assertion - not sure if safe:
    ConstantPool.importFromJson: // assert !constants.has(key);

@github-actions

github-actions Bot commented Dec 9, 2022 •

Copy link
Copy Markdown
Contributor

Test Results

   931 files  +1     931 suites  +1   50m 27s ⏱️ + 1m 59s
5 834 tests +1  5 798 ✔️ ±0  36 💤 +1  0 ❌ ±0 
6 088 runs  +8  6 045 ✔️ +7  43 💤 +1  0 ❌ ±0 

Results for commit d06303f. ± Comparison against base commit e8cf52e.

♻️ This comment has been updated with latest results.

@MarcinVaadin
MarcinVaadin marked this pull request as ready for review December 12, 2022 09:51
Artur-
Artur- previously requested changes Dec 12, 2022
@Artur-

Artur- commented Dec 12, 2022

Copy link
Copy Markdown
Member

Would also need at least one test

@Artur-

Artur- commented Dec 12, 2022

Copy link
Copy Markdown
Member

When testing this, I see a request to http://localhost:8080/?v-r=session-resync but that has a 403 response saying "session expired"

@MarcinVaadin

Copy link
Copy Markdown
Contributor Author

When testing this, I see a request to http://localhost:8080/?v-r=session-resync but that has a 403 response saying "session expired"

image

That's strange...

@MarcinVaadin

Copy link
Copy Markdown
Contributor Author

Would also need at least one test

Test added

@MarcinVaadin
MarcinVaadin requested a review from Artur- December 13, 2022 20:35
@vaadin-bot vaadin-bot added +1.0.0 and removed +0.1.0 labels Dec 13, 2022
@vaadin-bot vaadin-bot added +0.1.0 and removed +1.0.0 labels Dec 13, 2022
@mcollovati

Copy link
Copy Markdown
Collaborator

Tested manually and it seems to work as expected

@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @MarcinVaadin and @MarcinVaadin, when i performed cherry-pick to this commit to 23.3, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick be4572d
error: could not apply be4572d... feat: Session resynchronization for embedded webcomponents (#15421)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @MarcinVaadin and @MarcinVaadin, when i performed cherry-pick to this commit to 23.2, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick be4572d
error: could not apply be4572d... feat: Session resynchronization for embedded webcomponents (#15421)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @MarcinVaadin and @MarcinVaadin, when i performed cherry-pick to this commit to 2.8, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick be4572d
error: could not apply be4572d... feat: Session resynchronization for embedded webcomponents (#15421)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @MarcinVaadin and @MarcinVaadin, when i performed cherry-pick to this commit to 9.0, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick be4572d
error: could not apply be4572d... feat: Session resynchronization for embedded webcomponents (#15421)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

mcollovati pushed a commit that referenced this pull request Dec 22, 2022
* feat: added session resynchronization for embedded webcomponents

Fixes: #12592

Co-authored by: @mcollovati
mcollovati pushed a commit that referenced this pull request Dec 22, 2022
* feat: added session resynchronization for embedded webcomponents

Fixes: #12592

Co-authored by: @mcollovati
mcollovati pushed a commit that referenced this pull request Dec 22, 2022
* feat: added session resynchronization for embedded webcomponents

Fixes: #12592

Co-authored by: @mcollovati
mcollovati pushed a commit that referenced this pull request Dec 22, 2022
* feat: added session resynchronization for embedded webcomponents

Fixes: #12592

Co-authored by: @mcollovati
mcollovati added a commit that referenced this pull request Dec 22, 2022
…15541)

Fixes: #12592

Co-authored-by: marcin <marcin@vaadin.com>
Co-authored by: @mcollovati
mcollovati added a commit that referenced this pull request Dec 22, 2022
…15542)

Fixes: #12592

Co-authored by: @mcollovati
Co-authored-by: marcin <marcin@vaadin.com>
MarcinVaadin added a commit that referenced this pull request Dec 22, 2022
…CP: 9.0) (#15543)

* feat: Session resynchronization for embedded webcomponents (#15421)
@MarcinVaadin MarcinVaadin changed the title feat: Session resynchronization for embedded webcomponents fix: Session resynchronization for embedded webcomponents Dec 23, 2022
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.0.0.alpha7 and is also targeting the upcoming stable 24.0.0 version.

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.

Reconnect/reload an embedded component when the server connection is lost

4 participants