Skip to content

fix: Fix broken state from an invalid folderId in the path#8790

Merged
ogabrielluiz merged 3 commits into
mainfrom
lfoss-1617
Jul 1, 2025
Merged

fix: Fix broken state from an invalid folderId in the path#8790
ogabrielluiz merged 3 commits into
mainfrom
lfoss-1617

Conversation

@mfortman11
Copy link
Copy Markdown
Collaborator

@mfortman11 mfortman11 commented Jun 30, 2025

The Bug
Discovered during superuser and new user testing there was a stale state when a user logged in to new users account when the login url contained a redirect to a specific folder which the now active user did not have.

The easier way to reproduce is just to update the folderId to something incorrect

the fix
Adds a simple check to see if the id in the url matches one of the users folders if not we redirect to /all

Summary by CodeRabbit

  • Bug Fixes
    • Improved folder navigation by automatically redirecting users to the default view if an invalid folder ID is detected in the URL.
    • Removed unnecessary console log statements for a cleaner user experience.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 30, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes remove two debugging console statements from a custom node component and add a folder existence validation in the home page. The new logic checks if the folder ID in the URL matches an existing folder and redirects to "/all" if not found.

Changes

File(s) Change Summary
src/frontend/src/CustomNodes/NoteNode/index.tsx Removed two console.log statements used for debugging.
src/frontend/src/pages/MainPage/pages/homePage/index.tsx Added folder existence validation: redirects to "/all" if the folderId in the URL is invalid.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomePage
    participant Store
    participant Router

    User->>HomePage: Navigates to HomePage with folderId in URL
    HomePage->>Store: Retrieves folders list
    HomePage->>HomePage: useEffect checks if folderId exists in folders
    alt folderId not found
        HomePage->>Router: Redirect to "/all"
    end
Loading
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch lfoss-1617

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jun 30, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 30, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff00eb5 and 5d1899f.

📒 Files selected for processing (2)
  • src/frontend/src/CustomNodes/NoteNode/index.tsx (1 hunks)
  • src/frontend/src/pages/MainPage/pages/homePage/index.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`src/frontend/**/*.{ts,tsx}`: Use React 18 with TypeScript for all UI components and frontend logic.

src/frontend/**/*.{ts,tsx}: Use React 18 with TypeScript for all UI components and frontend logic.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/frontend_development.mdc)

List of files the instruction was applied to:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/MainPage/pages/homePage/index.tsx
`src/frontend/**/*.{ts,tsx,js,jsx,css,scss}`: Use Tailwind CSS for styling all frontend components.

src/frontend/**/*.{ts,tsx,js,jsx,css,scss}: Use Tailwind CSS for styling all frontend components.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/frontend_development.mdc)

List of files the instruction was applied to:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/MainPage/pages/homePage/index.tsx
🧠 Learnings (2)
src/frontend/src/CustomNodes/NoteNode/index.tsx (2)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: React Flow should be used for flow graph visualization, with nodes and edges passed as props, and changes handled via onNodesChange and onEdgesChange callbacks.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: Custom React Flow node types should be implemented as memoized components, using Handle components for connection points and supporting optional icons and labels.
src/frontend/src/pages/MainPage/pages/homePage/index.tsx (5)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-30T14:40:29.494Z
Learning: Applies to src/frontend/**/*.{ts,tsx} : Use React 18 with TypeScript for all UI components and frontend logic.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-30T14:40:29.494Z
Learning: Applies to src/frontend/src/stores/**/*.{ts,tsx} : Use Zustand for state management in frontend stores.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-30T14:40:29.494Z
Learning: Applies to src/frontend/src/{components,hooks}/**/*.{ts,tsx} : Implement dark mode support in components and hooks where needed.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-30T14:40:29.494Z
Learning: Applies to src/frontend/src/components/**/*FlowGraph.tsx : Use React Flow for flow graph visualization components.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: Custom React Flow node types should be implemented as memoized components, using Handle components for connection points and supporting optional icons and labels.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: autofix
🔇 Additional comments (3)
src/frontend/src/CustomNodes/NoteNode/index.tsx (1)

87-87: LGTM! Good cleanup of debugging statements.

Removing console.log statements improves production code quality and reduces unnecessary runtime logging noise.

src/frontend/src/pages/MainPage/pages/homePage/index.tsx (2)

11-11: LGTM! Appropriate import for navigation functionality.

The custom navigation hook import aligns with the folder validation feature being implemented.


34-34: LGTM! Proper hook initialization.

The navigation hook is correctly initialized and will be stable across re-renders.

Comment thread src/frontend/src/pages/MainPage/pages/homePage/index.tsx
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 30, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 30, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 1, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 1, 2025
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Jul 1, 2025
Merged via the queue into main with commit 7d44121 Jul 1, 2025
53 checks passed
@ogabrielluiz ogabrielluiz deleted the lfoss-1617 branch July 1, 2025 12:26
lucaseduoli pushed a commit that referenced this pull request Jul 1, 2025
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
ogabrielluiz pushed a commit that referenced this pull request Jul 2, 2025
jordanrfrazier pushed a commit that referenced this pull request Jul 3, 2025
ogabrielluiz pushed a commit that referenced this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants