75164[BUGFIX] Fix page reloading on click on preview button
Commit message
Review
-
Code review CR +2 Done
- Stefan Bürk +2
- Benjamin Franzke +1
-
Verified V +2 Done
- Stefan Bürk +2
- Benjamin Franzke +1
- core-ci +1 CI
Issues 1
Files 7
- Build/Sources/TypeScript/backend/form-engine.ts+4 −2
- Build/Sources/TypeScript/backend/utility.ts15+44 −0
- Build/Sources/TypeScript/backend/window-manager.ts9+9 −3
- typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js+1 −1
- typo3/sysext/backend/Resources/Public/JavaScript/utility.js+1 −1
- typo3/sysext/backend/Resources/Public/JavaScript/window-manager.js+1 −1
- typo3/sysext/core/Tests/Acceptance/Application/Frontend/SitemapXmlCest.php+23 −2
Review log 4356
Show 2331 earlier messages
-
Tobias Jungmann uploaded patch set 1 07/13/22, 09:32
-
Tobias Jungmann uploaded patch set 2 07/13/22, 09:46
-
core-ci voted on patch set 1 V -1 07/13/22, 09:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29045
-
core-ci voted on patch set 2 V -1 07/13/22, 09:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29047
-
rgropp commented on patch set 2 V +1 07/15/22, 10:56
Works as expected Page preview reloads correctly Tested following workflows: Page Module - CE editied -> save -> view - CE editied -> view -> save in dialog - CE editied -> save -> close -> view (page) - CE editied -> close -> save in dialog -> view (page) List Module - CE editied -> save -> view - CE editied -> view -> save in dialog - CE editied -> save -> close -> view (page) - CE editied -> close -> save in dialog -> view (page) -
Björn Jacob commented on patch set 2 CR -1 07/15/22, 14:18
As discussed with Tobi, please extend the commit message. Let's have it for v11 as well. Please fix the tests. -
Tobias Jungmann uploaded patch set 3 07/15/22, 15:12
-
core-ci voted on patch set 3 V +1 07/15/22, 15:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29227
-
Tobias Jungmann updated the commit message in patch set 4 07/18/22, 06:36
-
core-ci voted on patch set 4 V +1 07/18/22, 06:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29328
-
rgropp commented on patch set 4 V +1 07/18/22, 08:11
Works as expected Page preview reloads correctly Tested following workflows: Page Module * CE editied -> save -> view * CE editied -> view -> save in dialog * CE editied -> save -> close -> view (page) * CE editied -> close -> save in dialog -> view (page) List Module * CE editied -> save -> view * CE editied -> view -> save in dialog * CE editied -> save -> close -> view (page) * CE editied -> close -> save in dialog -> view (page) -
Andreas Kienast commented on patch set 4 CR -1 07/22/22, 07:12
on it -
Andreas Kienast uploaded patch set 5 07/22/22, 07:23
-
Andreas Kienast commented on patch set 5 V +1 CR +1 07/22/22, 07:24
Thank you very much for your work! -
core-ci voted on patch set 5 V +1 07/22/22, 07:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29416
-
Stefan Bürk commented on patch set 5 07/22/22, 20:10
Thanks for your work on this patch. So, we open for different pages independent preview tabs ? Should we not simply open preview things in one preview tab and alwas reload it if a named window exists ? only for the "same page" which is "similar" it keeps it ? Once it opens a "second" tab and you switch back to previous page, you get a third preview tab. I'm not much an editor, but I think in older versions this was the case (not re-tested). Is this really the behaviour we want ? -
Tobias Jungmann commented on patch set 5 07/25/22, 06:40
Reply
No, we don't open multiple tabs. It's only one tab with a specific name ("newTYPO3frontendWindow"). Previews are always opened in this specific tab. But you don't need to reload the tab if you switch to another page (other URL, not similar). That's the behaviour it should have. Did your tests showed your described behaviour?Reply
Thanks a lot for your fixes! -
Stefan Bürk commented on patch set 5 07/25/22, 07:51
Reply
Correct, my test showed different behaviour -
Tobias Jungmann commented on patch set 5 07/25/22, 10:22
Reply
Hmm, I cannot reproduce this behaviour. I only get one tab for previews Can you please describe your approach step by step? Which browser do you use? -
Stefan Bürk commented on patch set 5 07/25/22, 20:19
Reply
Ok, to be precise. Normal page layout is working as intended. But not if you are in a workspace and try to open it for different languages and switch in workspace between pages .. sometimes it reuses the tab, sometimes it opens a new one. So you are starting to collect tabs (in workspaces / multi language preview openenings). But I would guess, that's another part of the system. Do you want to investigate this and add it here too ? Or leave that for a dedicated patch ? -
Tobias Jungmann commented on patch set 5 07/29/22, 18:49
Reply
Oh, okay, I see. Thanks a lot for your precise description. I think I will leave it for another patch. -
Stefan Bürk commented on patch set 5 V +1 CR +1 07/30/22, 17:57
Reply
Okay with that. -
Simon Schaufelberger uploaded patch set 6 08/03/22, 20:51
-
core-ci voted on patch set 6 V -1 08/03/22, 21:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29802
-
core-ci commented on patch set 6 08/03/22, 21:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29802
-
core-ci voted on patch set 6 V +1 08/03/22, 21:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29802
-
Björn Jacob voted on patch set 6 V +1 CR +1 08/08/22, 13:41
-
rgropp voted on patch set 6 V +1 CR +1 08/09/22, 06:12
-
Stefan Bürk commented on patch set 6 08/15/22, 07:29
Mhh - can someone provide the 11.5 backport beforehand ? -
Tobias Jungmann commented on patch set 6 08/16/22, 11:20
Reply
I cherry-picked this patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75492 Had to adjust it to v11.5 typoscript/javascript logic. Please review and verify that patch, too. -
Stefan Bürk commented on patch set 6 CR -1 08/17/22, 06:53
backport still have issues - thus putting temp -1 on the main patch to raise awareness for it
-
Tobias Jungmann uploaded patch set 7 08/22/22, 09:48
-
core-ci voted on patch set 7 V +1 08/22/22, 09:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30345
-
Björn Jacob voted on patch set 7 V +1 CR +1 08/22/22, 10:14
-
Andreas Häfner voted on patch set 7 V +1 CR +1 08/22/22, 11:22
-
Oliver Hader commented on patch set 7 CR -1 08/22/22, 13:38
utility.ts:184"similar" might be misleading here... what about a different name like `sameOriginAndPath(a,b)`?utility.ts:194`const` for both uriObjects (skipping the `let` above)?utility.ts:200This `replace` call takes any first slash. I guess this should be more explicit like `replace(/^\//`)`... Besides that, `pathname` always has a trailing slash - couldn't it just be `url.origin + url.pathname` instead?utility.ts:215superfluous cast... what about two line? ``` try { new URL(url); return true; } ... ```window-manager.ts:39Why is the explicit type check for `Window` removed? What is `existingWindow === existingWindow.self` supposed to check?window-manager.ts:42There are scenarios where URL query-params shall not be ignored... ignoring query-params would be another/different option... -
Tobias Jungmann uploaded patch set 8 08/22/22, 17:06
-
Tobias Jungmann commented on patch set 8 08/22/22, 17:06
utility.ts:184ReplyDoneutility.ts:194ReplyThis won't work. Variables delcared in a try-catch-scope are not accesible outside of that scope.utility.ts:200ReplyYou are right. But pathnames may have trailing slashes. You meant slashes at the beginning. I fixed it by adding the appropriate regex.utility.ts:215ReplyDonewindow-manager.ts:39ReplyBecause `existingWindow instanceof Window` will always return false. Don't know exactly why, found this: https://github.com/jsdom/jsdom/issues/2740 The self-check is a weak method to check if the window is a window (and is opened). But I found a better solution (see change)window-manager.ts:42ReplyIn my opinion it's a bit overdone to check for equality of the query params. I would reload the page even if the query parameters have changed. But if you insist, I will build in a query checker ;) -
core-ci voted on patch set 8 V +1 08/22/22, 17:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30355
-
Benjamin Franzke uploaded patch set 9 08/22/22, 18:40
-
Benjamin Franzke commented on patch set 9 08/22/22, 18:40
window-manager.ts:44This causes the URL hash not to be updated, if another content element on the same page was edited before. We should probably use existingWindow.location.replace(uri); before the call to reload(). Did so with latest patchset 9. -
core-ci voted on patch set 9 V +1 08/22/22, 18:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30360
-
Benjamin Franzke uploaded patch set 10 08/23/22, 20:34
-
Benjamin Franzke commented on patch set 10 08/23/22, 20:34
Reply
Updated the cherry-pick. Therefore resolved.utility.ts:194ReplyLet's just move the concat into the try-block.utility.ts:200ReplyI do not understand why you've now added a regex that replaces trailing slashes, while the solution before removed leading slashes. Urls with different slashes are not similar, so we shouldn't unify here. I've dropped that part.window-manager.ts:39ReplyNote that it is not related to the jsdom issue that was linked (because jsdom is a DOM emulation for nodejs, e.g. unit testing, but isn't used in our case). Still you assertion/discovery is true, exstingWindow is not an instanceof Window, because the objects between multiple contexts are not shared. The behaviour is described in: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_contexts_e.g._frames_or_windows So this fix is fine, but deserves a comment IMO. Done.window-manager.ts:42ReplyI agree that we should check the query string. The user may have navigated the page and therefore the "view" action should assert that possible query strings are removed, otherwise it is not a real `view` of the canonical URL of the requested element/page. I've adapted the code to do so. -
core-ci voted on patch set 10 V +1 08/23/22, 20:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30391
-
Stefan Bürk commented on patch set 10 08/24/22, 04:26
window-manager.ts:40This sentence is kind of broken. Or is a simple point missing ? -
Benjamin Franzke uploaded patch set 11 08/24/22, 06:09
-
Benjamin Franzke commented on patch set 11 08/24/22, 06:09
window-manager.ts:40ReplyAck, the word "as" was missing after "here". -
core-ci voted on patch set 11 V +1 08/24/22, 06:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30398
-
Tobias Jungmann commented on patch set 11 08/24/22, 06:33
utility.ts:200ReplyI missed the trailing slash before. We need this part because the page will not reload if you first open a new window without a trailing slash and then with a trailing slash. ``` const url = 'https://test.com/test';; window.open(url, 'test'); window.open(url + '/', 'test'); //does not reload the page ``` So imho we should keep that part. -
Tobias Jungmann commented on patch set 11 08/24/22, 06:42
utility.ts:197This will return false if the query params are equal but have different order. `https://test.com?foo=1&bar=2` is the same like `https://test.com?bar=2&foo=1` but the strings are not equal. Shouldn't we check this before? -
Benjamin Franzke commented on patch set 11 08/24/22, 06:47
utility.ts:197ReplyNo, the browser will trigger a reload in that case. It is *another* resource from the view of the browser (doesn't matter that php treats it as the same), therefore an explicit reload() is not needed.utility.ts:200ReplyYour example uses a leading slash. https://test.com/test and https://test.com/test/ are different URLs and will browser to perform a new request. No reload is/should be needed. -
Tobias Jungmann commented on patch set 11 08/24/22, 07:01
utility.ts:200ReplyUh, you're right. Tried it on Chrome in an emtpy/new tab in the console and the browser wouldn't reload. But it reloads if you execute the code on a "normal" site. Interesting ... -
Stefan Bürk voted on patch set 11 V +1 CR +1 08/24/22, 11:13
-
Stefan Bürk voted on patch set 11 V +2 CR +2 08/24/22, 11:15
-
Stefan Bürk merged patch set 12 08/24/22, 11:15