RocketChat / RocketChat/Rocket.Chat
Admin → Layout: Custom Login and Enter Chat Scripts Trigger on Page Load Instead of Correct Auth/Navigation Events
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
In Admin → Settings → Layout → Customize the look of your workspace → Custom Scripts, the following options are available:
Custom Script for Logout Flow
Custom Script for Login Flow
Custom Script for Enter Chat (when user is already logged in)
However, their behavior does not match expected authentication and navigation lifecycle events.
Steps to reproduce:
Go to Admin → Settings → Layout
Add different test scripts in all three fields, for example:
console.log("Logout Script");
console.log("Login Script");
console.log("Enter Chat Script");
Save changes.
Open browser console.
Test the following actions:
Logout
Login
Navigate to chat
Refresh the page
Expected behavior:
Logout script should run only when user logs out.
Login script should run only after successful authentication.
Enter Chat script should run when the user enters the chat area while already logged in, without requiring a manual page refresh.
Actual behavior:
When logging out:
Logout script runs (expected)
Login script also runs immediately after logout (unexpected)
When logging in:
Login script does NOT run after successful authentication
"Enter Chat" script:
Does NOT run when navigating into chat after login
Only runs after manually refreshing the page while already logged in
Observation
It appears these scripts are executed on page render or route mount rather than on actual authentication or navigation lifecycle events.
This makes the behavior inconsistent with the naming of the settings and potentially misleading for administrators configuring custom workspace behavior.
Environment
Develop branch (latest synced)
Running locally via yarn dev
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Admin → Settings → Layout → Customize the look of your workspace → Custom Scripts, then reproduce the logout, login, chat navigation, and refresh flows with the browser console while running yarn dev. Done means each script runs only for its corresponding authentication or navigation event, including Enter Chat without a manual refresh.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100