Skip to content

Fix: Board infinity redirect multiperson property#176

Open
Rajat-Dabade wants to merge 1 commit intomainfrom
crash-fix-multiperson-propery
Open

Fix: Board infinity redirect multiperson property#176
Rajat-Dabade wants to merge 1 commit intomainfrom
crash-fix-multiperson-propery

Conversation

@Rajat-Dabade
Copy link
Contributor

@Rajat-Dabade Rajat-Dabade commented Mar 11, 2026

Summary

Root Cause:
The crash happened in sortCards in webapp/src/store/cards.ts when:

  • The board was sorted by a multi-person property.
  • The page was refreshed.
  • boardUsers was still empty because fetchBoardMembers had not finished.
  • For multiPerson, the code only converted arrays to strings when usersById was non-empty.
  • When usersById was empty, aValue and bValue stayed as arrays (e.g. ["user_id_1", "user_id_2"]).
  • The code then called (aValue as string).localeCompare(bValue as string).
  • At runtime, aValue was still an array, so localeCompare was called on an array and caused TypeError: aValue.localeCompare is not a function.
  • That error was caught by the React ErrorBoundary, which redirected to /error?id=unknown.

Steps to reproduce:

  • Create a new board with the template "Company Goals and OKRs"
  • Create a new "board view" in the top left
  • On one of the existing cards in the category, add a multi-person property
  • Add yourself to this field on two of the cards in the view
  • Set the sort for the view to that multi-person property
  • After this, clicking the 3 dots and then “copy link” should produce links with the bug for any card on that view. Changing the sort to anything other than that property should also fix it.

Before:

Screen.Recording.2026-03-11.at.2.20.21.PM.mov

After:

Screen.Recording.2026-03-11.at.2.14.27.PM.mov

Ticket Link

https://mattermost.atlassian.net/browse/MM-65641

@Rajat-Dabade Rajat-Dabade self-assigned this Mar 11, 2026
@Rajat-Dabade Rajat-Dabade added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Mar 11, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

📝 Walkthrough

Walkthrough

Sort logic in cards.ts now safely handles date parsing failures with try/catch, resetting unparseable values to empty strings. Multi-person value handling is enhanced to convert arrays to comma-joined strings when user data is unavailable, preventing runtime errors.

Changes

Cohort / File(s) Summary
Sort and Data Handling Improvements
webapp/src/store/cards.ts
Added try/catch safeguard for date parsing in sort logic to prevent crashes on parse failure. Enhanced multiPerson handling to conditionally transform arrays to usernames (when user data available) or comma-joined strings (as fallback), replacing direct toString approach.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main bug fix: preventing an infinity redirect caused by sorting boards by multi-person properties before user data is loaded.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch crash-fix-multiperson-propery

Comment @coderabbitai help to get the list of available commands and usage tips.

@marianunez
Copy link
Member

marianunez commented Mar 11, 2026

  • That error was caught by the React ErrorBoundary, which redirected to /error?id=unknown.

@Rajat-Dabade As we discussed offline, it seems this PR fixes the issue that was causing the error.

However, do we know why the redirects are happening when it finds an error? The customer reported that it kept looping an adding /error to the url like: http://localhost:8065/boards/team/ragwjr9o3jgr8cep5zh3hqh5na/bhcnsg4cu3jyy5qdczeknsdwdfe/vq8ymopyhipnffjoi119dpyybra/boards/boards/boards/boards/boards/boards/boards/boards/error - see the message here

We can complete this PR and ship this fix to the customer but it's important that we find the cause of the redirects when there are errors because there may be other instances that there are errors and it should be able to manage them gracefully.

@marianunez
Copy link
Member

Harshil is OOO so you probably need to swap him out for another reviewer

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

Labels

2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants