watson-developer-cloud / discovery-components

IBM Watson Discovery components
https://watson-developer-cloud.github.io/discovery-components/storybook
Apache License 2.0
22 stars 38 forks source link

feat: PDF view, single tooltip, show when hovering/selecting an enrichment #529

Closed dorianmiller closed 1 year ago

dorianmiller commented 1 year ago

What do these changes do/fix?

Tooltips for enrichments is implemented in components. It is accessed through the discovery tooling:

image

How do you test/verify these changes?

  1. Create project with trained SDU model. This creates the text mappings for the PDF view.
  2. Search for documents, select a document
  3. Open the advanced view
  4. Select one or more enrichments.
  5. Mouse over enrichments to see tooltips.

Have you documented your changes (if necessary)?

In the code

Are there any breaking changes included in this pull request?

No

CLAassistant commented 1 year ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

noah-eigenfeld commented 1 year ago

I'm noticing a significant slowdown with the latest changes when I try to select new facets to highlight. It's not too bad when you have a small number of highlights (say 5 to 10, which produce about a second of delay between my clicking and the highlights rendering). But when you have facets with hundreds or thousands of highlights to render, I've seen as long as 12 seconds of wait time. Chrome and Firefox produce longer delays for me than Safari, but the delay's are still noticeable even there.

Here's the file I'm using to test. V2 Entities should give you some options with high numbers of fields to highlight.

I'll need to look over your code more tomorrow to isolate the cause, but I figured I'd let you know now, so you've got a head start on a fix.

Edit: Actually, this problem only seems to happen in Text view. I forgot which order we were doing these in. Still probably something we want to fix, but I don't see any slowdown when I switch to highlighting in PDF view.

noah-eigenfeld commented 1 year ago

Also, just noticed that we'll need to put in something to handle the passage highlight from the result (default that shows up when you navigate from a result preview to the advanced doc view). I get these errors across my screen whenever my mouse hovers over the passage highlight.

Screenshot 2023-07-31 at 5 24 07 PM
noah-eigenfeld commented 1 year ago

~During testing, I noticed that hovering over the highlights in the document preview (before you open advanced doc view) activates the styling around highlights, and also makes the new tooltip pop up with a couple pieces of punctuation where the highlight info would be. We probably need some logic to enable/disable the tooltips in the doc preview component used by both of these parent components.~

~Update: another quirk is that these always render on the very last highlight shown in the preview, no matter which line you're currently hovering over~

Screenshot 2023-08-22 at 11 01 15 AM

UPDATE: this turned out to be an error on my end while testing. With latest changes, I no longer see this behavior