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

IBX-7825: UDW Blank browse tab after going from bookmarks from search #1190

Merged
merged 3 commits into from
Mar 6, 2024

Conversation

tischsoic
Copy link
Contributor

Question Answer
JIRA issue https://issues.ibexa.co/browse/IBX-7825
Type bug
Target version v4.6
BC breaks no
Doc needed no

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (master for features, the oldest supported for bugs).
  • Asked for a review (ping @ibexa/engineering).

@tischsoic tischsoic self-assigned this Feb 26, 2024
return () => {
if (shouldRestorePreviousStateRef.current) {
setMarkedLocationId(markedLocationId);
Copy link
Contributor Author

@tischsoic tischsoic Feb 26, 2024

Choose a reason for hiding this comment

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

Note: So, how the bug worked:

  1. User searches for e.g. "a"
  2. SearchTabModule component is instantiated and stores markedLocationId and loadedLocationsMap which will be restored later on component destruction
  3. The Search component uses useSearchByQueryFetch, which clears loaded locations data on fetching search results (this is why we store these data during 2.)
  4. The user clicks Bookmark tab
  5. The SearchTabModule is destructed and functions restoring markedLocationId and loadedLocationsMap are being called but their call is not yet processed on the React level
  6. The BookmarksTabModule is being created.
  7. The BookmarksTabModule stores current markedLocationId and loadedLocationsMap in order to restore them later, but at the time of storing them, they haven't been restored yet in React as setMarkedLocationId and dispatchLoadedLocationsAction haven't been processed yet.
  8. The BookmarksTabModule performs clearance setMarkedLocationId(null); dispatchLoadedLocationsAction({ type: 'CLEAR_LOCATIONS' }); - functions are being called, but not processed yet by React.
  9. setMarkedLocationId and dispatchLoadedLocationsAction from the SearchTabModule are being processed by React but it is too late for the BookmarksTabModule to store them as it already did it.
  10. setMarkedLocationId and dispatchLoadedLocationsAction from the BookmarksTabModule are being processed by React
  11. The user clicks on the Browse tab
  12. The BookmarksTabModule is being destructed and restores wrong markedLocationId and loadedLocationsMap.

@tischsoic tischsoic changed the title IBX-7825: UDW Blank browse tab after goding from bookmarks from search IBX-7825: UDW Blank browse tab after going from bookmarks from search Feb 29, 2024
@barbaragr barbaragr self-assigned this Mar 5, 2024
@tischsoic tischsoic force-pushed the IBX-7825-blank-browse-tab-after-going-from-bookmarks branch from 7770e2c to b9c5e4d Compare March 5, 2024 09:47
Copy link

@barbaragr barbaragr left a comment

Choose a reason for hiding this comment

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

I've found one issue:

  1. Log in to the back office
  2. Click Create content from Quick actions
  3. Switch View into Grid view
  4. Click Bookmarks button
  5. Click search button and type for ex. "abc", confirm
  6. Click Browse button - udw is empty
  7. Click again Bookmark button and then Browse button - udw gets closed
    Console output:
    react-dom.production.min.js:79 Uncaught TypeError: Cannot read properties of null (reading 'markedLocationId')
Screen.Recording.2024-03-05.at.11.30.53.mov

@tischsoic tischsoic force-pushed the IBX-7825-blank-browse-tab-after-going-from-bookmarks branch from 6f1123f to 59753fb Compare March 5, 2024 16:34
Copy link

sonarcloud bot commented Mar 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@tischsoic tischsoic requested a review from barbaragr March 5, 2024 16:54
@@ -10,6 +10,7 @@ import { getIconPath } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scri

const SearchTabModule = () => {
const tabsConfig = useContext(TabsConfigContext);
const restorationStateRef = useRef(null);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: problem analogical to the problem from Bookmarks (https://github.com/ibexa/admin-ui/pull/1190/files#r1502186952) occurs in the Search.

Copy link

@barbaragr barbaragr left a comment

Choose a reason for hiding this comment

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

💪

@dew326 dew326 merged commit f62c849 into main Mar 6, 2024
23 checks passed
@dew326 dew326 deleted the IBX-7825-blank-browse-tab-after-going-from-bookmarks branch March 6, 2024 09:28
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.

5 participants