focalboard
focalboard copied to clipboard
Bug: Switching boards takes you to the template picker.
Steps to reproduce the behavior
See video attached below. https://user-images.githubusercontent.com/11034289/182689961-1a7f1403-d36f-4ab5-9cf4-ecd1987ddd61.mp4
Expected behavior
Boards should switch normally.
Edition and Platform
- Edition: Mattermost Boards (plugin)
- Version: 7.2
- Browser and OS: Chrome Mac
Additional context (optional)
Add any other context about the problem here, and any notes about the severity:
- Sev 1: Affects critical functionality without a workaround
- Sev 2: Affects major functionality with a difficult or non-obvious workaround
- Sev 3: Affects minor, non-critical functionality
Looks like this occurs when you search for and open a board on another team while being on a different team. Workaround is to switch teams and search for the board again.
@Pinjasaur Can you help investigate? Thanks cc @sbishel
Having a hard time consistently reproducing this locally. It happens when switching between boards on different teams, but only sometimes. It doesn't appear to be related to if you select the board via the mouse cursor or keyboard shortcuts. Makes me think it's somehow related to a race condition in state?
Any tips in reproducing? @wuwinson @asaadmahmood @ogi-m
@Pinjasaur It looks like it has to do with you searching and opening up a board that's on another team.
For example, on https://community-dr.staging.cloud.mattermost.com/boards/
- We have the
Contributors
team with the "Developer Meeting Agenda" board under the Focalboard category. - In the
Staff
team, we have the "Focalboard V1 Features" board under the Focalboard (Internal) category.
- Go to the
Contributors
team, and open the board switcher with Cmd+K / Ctrl+K - Search for and select the "Focalboard V1 Features" (which belongs to the
Staff
team) - See error - template picker is displayed instead of the board
- Now go to the
Staff
team, and open the board switcher with Cmd+K / Ctrl+K - Search for and select the "Developer Meeting Agenda" (which belongs to the
Contributors
team) - See error - template picker is displayed instead of the board.
- If you search for and select "Focalboard V1 Features" while on the
Staff
team, or search for and select "Developer Meeting Agenda" while on theContributors
team, then the boards load properly
See recording for reference:
https://user-images.githubusercontent.com/93531870/182743149-5b44a416-e0b7-40ea-b3d3-ba8ffca9d4f4.mov
Community clone doesn't have Boards plugin anymore (maybe due to the 7.2 deployment/migration that just happened in the last day)—able to repro more or less consistently on community.mattermost.com.
OK, narrowed it down more. On community.mattermost.com:
Browsing Focalboard Q&A board on Contributors, open switcher & search focal
and select the first result which is Focalboard OKRs on Staff team. URL becomes:
-
https://community.mattermost.com/boards/team/qghzt68dq7bopgqamcnziq69ao/b1kkw5iy54pnqtjti6y84u436aa/v8w1odtuus3gbzghwquk7m4xr6c
which repros the case above
Now, do the same steps & select the same board as before. URL is now (and it renders as expected):
-
https://community.mattermost.com/boards/team/qghzt68dq7bopgqamcnziq69ao/bfpp6zftgd7nazm49xk7rip559y/vpg3zaxs9kpnwjpuzx3rp3s9u8c
Notice the different board & view IDs.
@harshilsharma63 took me a while but I tracked it down to the plugin: https://github.com/mattermost/focalboard/blob/683682a08677ca574e085a44484b0c8d4233c2b7/mattermost-plugin/webapp/src/index.tsx#L243
I haven't had a chance to dig into it to a better or more appropriate way to handle it. Makes sense why it's so inconsistent—it's all dependent on the redux state and my local environment state is much less complicated than community.
Let me know if you have any ideas on how to fix it. It seems relatively fragile as-is with some complex dependencies on the Mattermost store and the Focalboard store and making sure we're pub/sub-ing changes from each of them. @jespino I know you just did that change in #3602 which touched some adjacent code—maybe you have an idea?
cc @sbishel
Here's the current patch we're working with.
diff --git a/mattermost-plugin/webapp/src/index.tsx b/mattermost-plugin/webapp/src/index.tsx
index 92843ffa..74d806c8 100644
--- a/mattermost-plugin/webapp/src/index.tsx
+++ b/mattermost-plugin/webapp/src/index.tsx
@@ -241,7 +241,9 @@ export default class Plugin {
const currentTeamID = mmStore.getState().entities.teams.currentTeamId
if (currentTeamID && currentTeamID !== prevTeamID) {
if (prevTeamID && window.location.pathname.startsWith(windowAny.frontendBaseURL || '')) {
- browserHistory.push(`/team/${currentTeamID}`)
+ // Not already on a URL for the team
+ if (!window.location.pathname.startsWith(`${(windowAny.frontendBaseURL || '')}/team/${currentTeamID}`))
+ browserHistory.push(`/team/${currentTeamID}`)
}
prevTeamID = currentTeamID
store.dispatch(setTeam(currentTeamID))