Repository navigation
refactor/fix(settings): Refactor animation settings retrieval to fix problem with refreshing. - #21284
Conversation
…problem with refreshing.
WalkthroughThe changes involve modifications to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
bigbluebutton-html5/imports/ui/services/settings/index.js (1)
36-40: LGTM! Consider a minor improvement for consistency.The changes effectively address the persistence issue for the animation settings, aligning with the PR objectives. The implementation is consistent with how the dark theme setting is handled.
For improved consistency and readability, consider combining the animation and dark theme settings into a single block:
const showAnimationsDefault = getFromUserSettings( 'bbb_show_animations_default', window.meetingClientSettings.public.app.defaultSettings.application.animations, ); const showDarkThemeDefault = getFromUserSettings( 'bbb_prefer_dark_theme', window.meetingClientSettings.public.app.defaultSettings.application.darkTheme, ); -writableDefaultValues.application.animations = showAnimationsDefault; -writableDefaultValues.application.darkTheme = showDarkThemeDefault; +Object.assign(writableDefaultValues.application, { + animations: showAnimationsDefault, + darkTheme: showDarkThemeDefault, +});This change would group related settings together and make future additions more straightforward.
Also applies to: 46-46
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- bigbluebutton-html5/imports/ui/components/layout/observer.tsx (0 hunks)
- bigbluebutton-html5/imports/ui/services/settings/index.js (1 hunks)
💤 Files with no reviewable changes (1)
- bigbluebutton-html5/imports/ui/components/layout/observer.tsx
🔇 Additional comments (1)
bigbluebutton-html5/imports/ui/services/settings/index.js (1)
36-46: Verify persistence of animation settings across page refreshes.The changes look good, but let's ensure that the
loadChangedandsavemethods correctly handle the new animation setting for persistence across page refreshes.Run the following script to verify the implementation:
This script will help us confirm that the animation settings are properly handled throughout the codebase, ensuring persistence across page refreshes as required by the PR objectives.
✅ Verification successful
This script will help us gather more information about the implementation and usage of animation settings throughout the codebase.
This script will help us understand the project structure and locate the relevant files containing information about animation settings.
This script will help us examine the content of the key files we've identified as potentially relevant to the animation settings and their persistence.
Animation settings are properly implemented and persisted.
The codebase demonstrates a robust implementation of animation settings:
The Settings class in
settings/index.jshandles loading and saving the animation setting, using either LocalStorage or SessionStorage based on the app configuration.The ApplicationMenu component in
application/component.jsxprovides a user interface to toggle the animation setting.The Base component in
base.jsxapplies the animation setting globally by adding or removing CSS classes on the HTML element.The save method in the Settings class ensures that changes to the animation setting are persisted, allowing them to survive page refreshes.
This implementation effectively addresses the concern about the persistence of animation settings across page refreshes.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of animation settings in loadChanged and save methods. # Test 1: Check if loadChanged method handles the animation setting echo "Checking loadChanged method:" rg --type js 'loadChanged.*animations' # Test 2: Check if save method handles the animation setting echo "Checking save method:" rg --type js 'save.*animations' # Test 3: Look for any direct uses of the animation setting echo "Checking direct uses of the animation setting:" rg --type js 'application\.animations' # Test 4: Verify if the animation setting is used in React components echo "Checking usage in React components:" rg --type js 'useContext.*Settings.*animations'Length of output: 400773
Script:
#!/bin/bash # Description: Further investigate animation settings implementation and usage # Check for loadChanged and save methods echo "Checking for loadChanged and save methods:" rg --type js 'function\s+(loadChanged|save)' # Check for animation setting in settings-related files echo "Checking for animation setting in settings-related files:" rg --type js 'animations?' imports/ui/services/settings/ # Look for animation-related components echo "Checking for animation-related components:" rg --type js 'animations?' imports/ui/components/ # Check for animation setting usage in main application file echo "Checking for animation setting usage in main application file:" rg --type js 'animations?' imports/ui/components/app/component.jsx # Look for any other files that might be handling animation settings echo "Checking for other files handling animation settings:" rg --type js 'animations?' imports/ui/Length of output: 1276
Script:
#!/bin/bash # Description: Explore project structure and locate relevant files # List the contents of the root directory echo "Contents of the root directory:" ls -la # Find all JavaScript files in the project echo "Finding all JavaScript files:" find . -name "*.js" -o -name "*.jsx" # Search for settings-related files echo "Searching for settings-related files:" find . -type f \( -name "*.js" -o -name "*.jsx" \) -exec grep -l "settings" {} + # Search for animation-related files echo "Searching for animation-related files:" find . -type f \( -name "*.js" -o -name "*.jsx" \) -exec grep -l "animation" {} + # Search for the main application file echo "Searching for the main application file:" find . -name "app.jsx" -o -name "main.jsx" -o -name "index.jsx" # Search for files containing both "settings" and "animation" echo "Searching for files containing both 'settings' and 'animation':" find . -type f \( -name "*.js" -o -name "*.jsx" \) -exec grep -l "settings" {} + | xargs grep -l "animation"Length of output: 68828
Script:
#!/bin/bash # Description: Examine key files related to animation settings echo "Checking settings/index.js file:" cat ./bigbluebutton-html5/imports/ui/services/settings/index.js echo "\nChecking application component for animation settings:" cat ./bigbluebutton-html5/imports/ui/components/settings/submenus/application/component.jsx echo "\nChecking base.jsx for initialization of settings:" cat ./bigbluebutton-html5/imports/startup/client/base.jsxLength of output: 31567
Automated tests Summary✅ All the CI tests have passed! |



What does this PR do?
This PR refactors a custom parameter/setting that was not persisting across page refreshes. It complements the changes introduced in PR 21255
.
Closes Issue(s)
#21260
How to test
bbb_prefer_dark_theme=trueorbbb_show_animations_default=false