Skip to content

Scrolling causes display issues: blank areas appear #7597

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

Open
oakif opened this issue Mar 6, 2025 · 6 comments
Open

Scrolling causes display issues: blank areas appear #7597

oakif opened this issue Mar 6, 2025 · 6 comments
Labels

Comments

@oakif
Copy link

oakif commented Mar 6, 2025

Description

Scrolling in a Jupyter Notebook often leads to display issues, for example large blank areas, or scrolling issues.

Image Image Image

Reproduce

  1. Open a relatively large document (at least 20 screens high)
  2. Try scrolling all the way up or down.

Expected behavior

Context

  • Operating System and version: macOS Sequoia 15.2
  • Browser and version: Microsoft Edge Version 133.0.3065.92
  • Jupyter Notebook version: 7.3.2
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter notebook` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.
@oakif oakif added bug status:Needs Triage Applied to issues that need triage labels Mar 6, 2025
@andrii-i
Copy link
Contributor

Hi @oakif. Thank you for creating this issue. Could you please share an example notebook in which you see this happening? This would really help with reproduction.

@HaileyTQuach
Copy link

Hi, I'm experiencing the same issue. I tested this using a notebook from the LangGraph repository (specifically the reflexion.ipynb example from https://github.com/langchain-ai/langgraph/blob/main/docs/docs/tutorials/reflexion/reflexion.ipynb).

I added a cell at the end of the notebook, and when I ran that cell and scrolled back up, I noticed all the previous cells had disappeared from view. For some reason, I cannot attach the notebook here, so you can download the notebook from the link I shared and add this code at the last cell and run everything. Hopefully this additional information helps identify the problem.

class ReflectionMemory:
    def __init__(self, file_path="reflection_memory.json"):
        self.file_path = file_path
        self.memory = self._load_memory()
    
    def _load_memory(self):
        try:
            with open(self.file_path, 'r') as f:
                return json.load(f)
        except (FileNotFoundError, json.JSONDecodeError):
            return {"reflections": []}
    
    def _save_memory(self):
        with open(self.file_path, 'w') as f:
            json.dump(self.memory, f)
    
    def add_reflection(self, question, reflection):
        self.memory["reflections"].append({
            "question": question,
            "reflection": reflection,
            "timestamp": datetime.datetime.now().isoformat()
        })
        self._save_memory()
    
    def get_relevant_reflections(self, question, limit=3):
        # In a real system, you'd use embedding similarity here
        return self.memory["reflections"][-limit:]

# Create instance
reflection_memory = ReflectionMemory()

# Modify the actor prompt to include past reflections
memory_actor_prompt = ChatPromptTemplate.from_messages([
    ("system", """You are an expert researcher.
Current time: {time}

Past reflections that might be relevant:
{past_reflections}

1. {first_instruction}
2. Reflect and critique your answer. Be severe to maximize improvement.
3. Recommend search queries to research information and improve your answer."""),
    MessagesPlaceholder(variable_name="messages"),
    ("user", "\n\nRespond using the {function_name} function."),
])

# Update the initial answer chain
def get_past_reflections(question):
    reflections = reflection_memory.get_relevant_reflections(question)
    if not reflections:
        return "No relevant past reflections."
    
    formatted = []
    for r in reflections:
        formatted.append(f"Question: {r['question']}\nReflection: {r['reflection']}")
    
    return "\n\n".join(formatted)

# Add function to store reflections after each run
def store_reflection(state):
    # Extract the original question and final reflection
    question = state["messages"][0].content
    final_tool_call = state["messages"][-1].tool_calls[0]
    
    if final_tool_call["name"] == ReviseAnswer.__name__:
        args = json.loads(final_tool_call["args"])
        reflection = args["reflection"]
        reflection_memory.add_reflection(question, reflection)
    
    return state

# Add to graph
builder.add_node("store_reflection", store_reflection)
builder.add_edge("fact_check", "store_reflection")
builder.add_edge("store_reflection", END)

@oakif
Copy link
Author

oakif commented Mar 17, 2025

@HaileyTQuach Thanks for detailing the bug and providing reproduction steps. I’ve tried following them with the downloaded notebook but haven’t been able to reproduce it consistently on my end. Granted, I haven't been able to reliably reproduce it in any of my notebooks—but it still keeps popping up from time to time. Hopefully, with these steps, someone else might be able to pinpoint the issue

@andrii-i andrii-i removed status:Needs Info status:Needs Triage Applied to issues that need triage labels Mar 17, 2025
@andrii-i
Copy link
Contributor

Thank you for the information @oakif and @HaileyTQuach. Would you be able to try with the 7.4 pre-release, to check if it fixes the issue? You can install it via:

pip install --pre notebook

@krassowski
Copy link
Member

This is jupyterlab/jupyterlab#17023

@oakif
Copy link
Author

oakif commented Mar 20, 2025

Thanks! I guess this can be marked as a duplicate. I haven't gotten a chance to try out the pre-release yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants