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

Shared database groups list get synced only after application reboot #11232

Open
2 tasks done
TsypliakAlexandr opened this issue Apr 21, 2024 · 2 comments · May be fixed by #11314
Open
2 tasks done

Shared database groups list get synced only after application reboot #11232

TsypliakAlexandr opened this issue Apr 21, 2024 · 2 comments · May be fixed by #11314

Comments

@TsypliakAlexandr
Copy link

JabRef version

Latest development branch build (please note build date below)

Operating system

Windows

Details on version and operating system

Windows 10 Pro 22H2 19045.4291

Checked with the latest development build (copy version output from About dialog)

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

Version used:
JafRef-5.14.msi version from 04/19/2024

Precondition:
Two Windows users got connected to same remote Postgres database

Steps to reproduce:

  1. User A creates adds new Groups name "Test"
  2. User A sees new group "Test"
  3. User B goes to File -> Shared Database and clicks "Pull changes from shared database"

Actual behavior:

  1. User B can't see new group "Test" created by user A

Expected behavior:

  1. User B sees new group "Test" created by user A

Workaround:

  1. User B closes application GUI, opens it again and connects to same remote Postgres database - then he can see new group "Test" created by user A

Appendix

No response

@Siedlerchr
Copy link
Member

Groups are part of the metadata and are synced as well when a new group is added, at least what I observed. I need to do some more testing to find out where exactly on the receiver side the sync does trigger a change/does not

@Siedlerchr
Copy link
Member

I debugged and analyzed a bit further, and I think I narrowed down the problem. It's mainly a UI issue.

As a workaround you can create a new empty library and just switch back and forth

  1. User A adds a new group to the shared database
  2. User B does not see the changes -> Switches to a new empty library and back
  3. Group is there

This works for adding or changing existing groups.

Code related:

/**
* Gets invoked if the user changes the active database.
* We need to get the new group tree and update the view
*/
private void onActiveDatabaseChanged(Optional<BibDatabaseContext> newDatabase) {
if (newDatabase.isPresent()) {
GroupNodeViewModel newRoot = newDatabase
.map(BibDatabaseContext::getMetaData)
.flatMap(MetaData::getGroups)
.map(root -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, root, localDragboard, preferences))
.orElse(GroupNodeViewModel.getAllEntriesGroup(newDatabase.get(), stateManager, taskExecutor, localDragboard, preferences));
rootGroup.setValue(newRoot);
if (stateManager.getSelectedGroups(newDatabase.get()).isEmpty()) {
stateManager.setSelectedGroups(newDatabase.get(), Collections.singletonList(newRoot.getGroupNode()));
}

Groups deletion seems to be a separate issue. That does not get synced correctly in the metadata. At least from my debugging observation

@Siedlerchr Siedlerchr linked a pull request May 20, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants