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

Opening newly uploaded documents with relationships from the relationship tree crashes the document viewer (8pts) #3499

Closed
txau opened this issue Mar 4, 2021 · 2 comments · Fixed by #3572

Comments

@txau
Copy link
Collaborator

txau commented Mar 4, 2021

  1. On a blank Uwazi create an empty default "Entity A".
  2. Upload a PDF document
  3. Edit "Entity A"'s relationships and connect it to the document.
  4. Save.
  5. Click on the "View" button of the document in the relationship tree.
  6. Uwazi tosses a JS error.

Uwazi is adding a "ref=xxxxx" param to the URL that should not be there.

@txau txau changed the title Bug on newly uploaded documents Opening newly uploaded documents with relationships from the relationship tree crashes the document viewer Mar 4, 2021
@konzz
Copy link
Member

konzz commented Mar 9, 2021

Info we have:

  • the ref=xxxxx is there so when you go to the document the text reference is activated and scroll to, so it needs to be there at least when you click in a connection that is a text reference, its probably not needed in other scenarios.
  • The error is because is trying to find the reference in entity.get('relations') but while ago we modified the viewer to retrieve the entity without relationships, probably related to performance
  • There are a few calls to request the entity when opening the entity view and we added a flag to don't ask for relations in the calls we considered unnecessary.

This issue will require more investigation to know how to fix it, but ideally we want to make sure that we have the relations before the code requires them.

@RafaPolit RafaPolit changed the title Opening newly uploaded documents with relationships from the relationship tree crashes the document viewer Opening newly uploaded documents with relationships from the relationship tree crashes the document viewer (8pts) Mar 23, 2021
@daneryl
Copy link
Collaborator

daneryl commented Mar 29, 2021

The error is because is trying to find the reference in entity.get('relations') but while ago we modified the viewer to retrieve the entity without relationships, probably related to performance

This is true, for performance reasons the entity omitRelationships flag request was added, simple solution will be to remove this flag and fix another minor error related to the deprecated pdfInfo and this should be solved for the majority of the scenarios.

now its not that simple for all cases, 2 main changes were made to avoid the performance issues

  • omitRelationships on the entity calls, this seem to not be needed at any point as the text references are requested in a separate request, and there where no failing tests. (we know now that are only needed to scroll to the passed ref on the url)

  • the getRelationshipsByDocument was hard limited to 300, this is true for both the request for text references and the relations returned on entities requests. this is why removing the omitRelationships flag solves the problem without again producing performance issues.

The moment a document has more than 300 relationships things break.
we can be trying to scroll to relationships that are not there because:

  • the relationship is outside the first 300
  • the text refs and entity refs are not the same and the relationship is on the entity but its not rendered.

i think we should fix this with the "quickFix" and move the 300 relationship limit problem to a tech debt if its not already.

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