Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Sep 25, 2025

Description

^

Fixes https://linear.app/danswer/issue/DAN-2501/after-putting-in-llm-key-models-dont-automatically-update-giving-the

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Additional Options

  • [Optional] Override Linear Check

Summary by cubic

Fixes startup by ensuring temperature is initialized when LLM providers load. Added llmProviders to the useLlmManager effect dependencies to avoid stale temperature on initial run.

Copy link

vercel bot commented Sep 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
internal-search Ready Ready Preview Comment Sep 25, 2025 11:44pm

@Weves Weves changed the title Fix startup fix: LlmPopover after filling in an initial model Sep 25, 2025
@raunakab raunakab marked this pull request as ready for review September 25, 2025 23:44
@raunakab raunakab requested a review from a team as a code owner September 25, 2025 23:44
@raunakab raunakab enabled auto-merge September 25, 2025 23:44
@raunakab raunakab self-requested a review September 25, 2025 23:44
Copy link
Contributor

@raunakab raunakab left a comment

Choose a reason for hiding this comment

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

🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR fixes a React hook dependency issue in useLlmManager by adding llmProviders to the useEffect dependency array. The fix prevents stale closures that could occur when LLM providers change after the initial render, ensuring that temperature initialization always uses the current provider state.

  • Fixed useEffect dependency array to include llmProviders parameter
  • Prevents stale closure bugs when provider configuration changes
  • Ensures temperature is correctly initialized based on current LLM providers

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects a simple, correct React hook dependency fix that follows React best practices and prevents potential bugs without introducing new complexity
  • No files require special attention

Important Files Changed

File Analysis

Filename        Score        Overview
web/src/lib/hooks.ts 5/5 Fixed React useEffect dependency array by adding llmProviders to prevent stale closures

Sequence Diagram

sequenceDiagram
    participant UI as UI Component
    participant Hook as useLlmManager
    participant State as React State
    
    UI->>Hook: Initial render with llmProviders
    Hook->>State: Initialize temperature (useState)
    Note over State: Temperature set based on currentChatSession/liveAssistant
    
    UI->>Hook: llmProviders change
    Hook->>Hook: useEffect triggers (with llmProviders in deps)
    Hook->>State: Update temperature based on new providers
    Note over Hook: Prevents stale closure with old llmProviders reference
    
    UI->>Hook: liveAssistant change
    Hook->>Hook: useEffect triggers
    Hook->>State: Recalculate temperature (0 for search tools, 0.5 default)
    
    UI->>Hook: currentChatSession change
    Hook->>Hook: useEffect triggers
    Hook->>State: Use session temperature override or default
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@Weves Weves disabled auto-merge September 26, 2025 00:09
@Weves Weves merged commit b80f96d into main Sep 26, 2025
61 of 69 checks passed
@Weves Weves deleted the fix-initial-setuo branch September 26, 2025 00:09
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