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

Log console status bar widget does not update #7325

Closed
jasongrout opened this issue Oct 11, 2019 · 4 comments · Fixed by #7334
Closed

Log console status bar widget does not update #7325

jasongrout opened this issue Oct 11, 2019 · 4 comments · Fixed by #7334
Labels
status:resolved-locked
Milestone

Comments

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Oct 11, 2019

Description

Log console status bar widget sometimes does not update its message count

Reproduce

On JupyterLab 1.2.0a1:

  1. Open a new notebook
  2. Open the Log Console and add a few timestamps so that there are some messages
  3. Observe that the message count in the status bar is updated
  4. Open a new launcher (not a notebook, just the launcher)
  5. Notice that when the launcher is focused, you still see the notebook's message count.

Expected behavior

In step 4, the message count should display zero messages.

Context

  • Operating System and version: macOS 10.14.6
  • Browser and version: Firefox 69
  • JupyterLab version: 1.2.0a1

CC @mbektasbbg

@jasongrout jasongrout added this to the 1.2 milestone Oct 11, 2019
@jasongrout jasongrout removed this from the 1.2 milestone Oct 11, 2019
@jasongrout jasongrout added this to the 2.0 milestone Oct 11, 2019
@jasongrout jasongrout added the tag:Backport label Oct 11, 2019
@jasongrout jasongrout removed this from the 2.0 milestone Oct 11, 2019
@jasongrout jasongrout added this to the 1.2 milestone Oct 11, 2019
@bw-space
Copy link
Contributor

@bw-space bw-space commented Oct 11, 2019

Can you help me find the log console of step 2, I am unable to find it.

@jasongrout
Copy link
Contributor Author

@jasongrout jasongrout commented Oct 11, 2019

You can open it from the view menu or by clicking on the message icon in the status bar.

@mbektas
Copy link
Member

@mbektas mbektas commented Oct 11, 2019

@jasongrout the reason for this behavior is, active source is updated when a new notebook is activated (https://github.com/jupyterlab/jupyterlab/blob/master/packages/logconsole-extension/src/index.tsx#L540) or a notebook is closed (https://github.com/jupyterlab/jupyterlab/blob/master/packages/logconsole-extension/src/index.tsx#L553).

I couldn't find a way to detect deactivation of a notebook/log source.

Is there a way to listen for deactivation of a notebook (or activation of another tab that is not a notebook)?

@jasongrout
Copy link
Contributor Author

@jasongrout jasongrout commented Oct 11, 2019

Good question. You could handle this similar to how the line numbers are handled in the status bar, and listen to the currentChanged signal on the lab shell:

labShell.currentChanged.connect((_, change) => {
const { oldValue, newValue } = change;
// Check if we need to disconnect the console listener
// or the notebook active cell listener
if (oldValue && consoleTracker.has(oldValue)) {
(oldValue as ConsolePanel).console.promptCellCreated.disconnect(
onPromptCreated
);
} else if (oldValue && notebookTracker.has(oldValue)) {
(oldValue as NotebookPanel).content.activeCellChanged.disconnect(
onActiveCellChanged
);
}

@jasongrout jasongrout removed the tag:Backport label Oct 12, 2019
@lock lock bot added the status:resolved-locked label Nov 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants