Skip to content

[ZEPPELIN-6533] Apply the notebook search term after the paragraph views exist - #5378

Open
kimyenac wants to merge 1 commit into
apache:masterfrom
kimyenac:ZEPPELIN-6533
Open

[ZEPPELIN-6533] Apply the notebook search term after the paragraph views exist#5378
kimyenac wants to merge 1 commit into
apache:masterfrom
kimyenac:ZEPPELIN-6533

Conversation

@kimyenac

@kimyenac kimyenac commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What is this PR for?

The notebook component reads the term query param in ngOnInit, which runs before @ViewChildren resolves and before the note arrives over the WebSocket. The initial term was applied to a paragraph query list that did not exist yet, and nothing re-applied it once the paragraphs rendered, so opening a note through a ?term=... deep link (for example clicking a notebook search result) never highlighted the matching text.

This keeps the term on the notebook component and re-applies it in ngAfterViewInit and whenever the paragraph query list changes. The code editor keeps the term as well, because Monaco loads asynchronously and would otherwise ignore a term that arrived before the editor was ready.

The guard suggested in the issue (listOfNotebookParagraphComponent?.forEach(...)) is already on master, so onParagraphSearch does not throw today. The access stays guarded here.

What type of PR is it?

Bug Fix

Todos

  • - Apply the search term once the paragraph views exist
  • - Apply the search term once the Monaco editor is ready
  • - Add an e2e regression test for the term deep link

What is the Jira issue?

How should this be tested?

  • Automated: e2e/tests/notebook/search/editor-search.spec.ts gains "highlights the term carried by a deep link when the notebook opens". Run it with npm run e2e:fast -- tests/notebook/search/editor-search.spec.ts in zeppelin-web-angular. The new test fails on master (0 highlights) and passes with this change; the rest of the spec and the notebook keyboard spec stay green.
  • Manual: create a note, put alpha target beta target gamma target in a paragraph, then open /#/notebook/<noteId>?term=target coming from another page. Every occurrence of target is highlighted. The same applies when clicking a result on the notebook search page, which navigates with paragraph and term query params.

Screenshots (if appropriate)

Before: nothing is highlighted when the note opens through the deep link.
After: the three target occurrences are highlighted.

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

…ews exist

The `term` query param is read in ngOnInit, which runs before @ViewChildren
resolves and before the note arrives over the WebSocket, so a deep-link term was
dropped: onParagraphSearch iterated a query list that did not exist yet, and
nothing re-applied the term once the paragraphs rendered.

Keep the term on the notebook component and (re)apply it in ngAfterViewInit and
whenever the paragraph query list changes. The code editor keeps the term too,
because Monaco loads asynchronously and would otherwise ignore a term that
arrived before the editor was ready.

Add a Playwright regression test that opens a notebook with a `term` query param
and asserts every occurrence is highlighted.

@voidmatcha voidmatcha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The existing Show/hide the code flow leaves a deep-linked search term unapplied when the paragraph editor starts hidden.

editorHide is not introduced by this PR. It is the existing persisted paragraph setting controlled by Show/hide the code; while it is true, NotebookParagraphCodeEditorComponent is not instantiated.

I reproduced the issue in a local Chromium E2E run:

  1. Hide a paragraph's code editor with Show/hide the code.
  2. Open the notebook through a URL containing ?term=target.
  3. Show the paragraph's code editor again.
  4. The editor appears, but the occurrences of target are not highlighted.

The search term is initially propagated while the code editor component does not exist, and it is not replayed when that component is created later. Please retain the latest search term at the paragraph boundary and apply it when the code editor becomes available, or add equivalent lifecycle handling. A regression E2E test covering the hidden-then-shown editor flow should be included as well.

Reproduction test and example fix:
voidmatcha@731e1ac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants