-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.11.6 #45
base: main
Are you sure you want to change the base?
1.11.6 #45
Conversation
Co-authored-by: Nuckyz <[email protected]>
WalkthroughThe pull request updates the package version in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AllowLevelSettings
participant Settings
participant ConsoleJanitor
User->>AllowLevelSettings: Toggle logging level checkbox
AllowLevelSettings->>Settings: Update allowLevel setting
Settings-->>AllowLevelSettings: Confirm update
User->>ConsoleJanitor: Trigger log event with level
ConsoleJanitor->>Settings: Retrieve current logging level
Settings-->>ConsoleJanitor: Return logging state
sequenceDiagram
participant Component
participant findStore
participant fluxStores
participant FluxStoreAPI
Component->>findStore: Request store by name
findStore->>fluxStores: Check for store in cache
alt Store exists
fluxStores-->>findStore: Return cached store
else
findStore->>FluxStoreAPI: Retrieve all stores
FluxStoreAPI-->>findStore: Return list of stores
findStore->>fluxStores: Cache the found store
end
findStore-->>Component: Return store
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
ERR_PNPM_OPTIONAL_DEPS_REQUIRE_PROD_DEPS Optional dependencies cannot be installed without production dependencies Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🔇 Additional comments (4)
✨ Finishing Touches
🪧 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
package.json
(1 hunks)src/plugins/_api/badges/index.tsx
(1 hunks)src/plugins/_api/chatButtons.ts
(1 hunks)src/plugins/_api/dynamicImageModalApi.ts
(1 hunks)src/plugins/consoleJanitor/index.tsx
(5 hunks)src/plugins/consoleShortcuts/index.ts
(1 hunks)src/plugins/crashHandler/index.ts
(1 hunks)src/plugins/gameActivityToggle/index.tsx
(1 hunks)src/plugins/imageZoom/index.tsx
(1 hunks)src/plugins/showMeYourName/index.tsx
(1 hunks)src/utils/types.ts
(3 hunks)src/webpack/common/components.ts
(1 hunks)src/webpack/common/types/components.d.ts
(2 hunks)src/webpack/webpack.ts
(3 hunks)
✅ Files skipped from review due to trivial changes (1)
- package.json
🔇 Additional comments (28)
src/plugins/_api/chatButtons.ts (1)
20-20
: Improved regex pattern for bundler compatibilityThe regex pattern has been updated to be more flexible by removing the specific condition
\i\.isDM
from the lookahead assertion. This broadens the matching criteria and helps address the bundler-related compatibility issue mentioned in the comment above.src/plugins/showMeYourName/index.tsx (1)
53-54
: More precise regex targetingThe updated regex pattern is more precise, specifically targeting the username formatting pattern
(\i\?"@":""\)\+\i
that follows afterchildren:
. This makes the patch more resilient to Discord code changes.src/plugins/gameActivityToggle/index.tsx (1)
98-98
:❓ Verification inconclusive
Updated selector for button insertion
The regex pattern has been changed to target elements with
className:\i\.buttons
instead ofthis\.renderNameZone\(\)
, adapting to Discord's current component structure.The pattern includes a
.{0,50}
limit beforechildren:\[
. Verify that this character limit is sufficient for all possible cases:
🏁 Script executed:
#!/bin/bash # Find potential matches with varying distances between className and children properties rg -U "className:.+?buttons.+?children:" --type=ts --type=tsxLength of output: 91
Verify Regex Gap Limit in Selector
The regex update now targets elements with
className:\i\.buttons
(in line with Discord’s current component structure) instead ofthis.renderNameZone()
. However, since our initial automated search usingrg --type=tsx
failed due to a file type recognition issue, please manually verify that the.{0,50}
limit beforechildren:\[
is sufficient for all cases. An adjusted search command has been provided below to include both TS and TSX files:#!/bin/bash # Search for relevant patterns in both .ts and .tsx files rg -U "className:.+?buttons.+?children:" --glob "*.ts" --glob "*.tsx"Make sure to review the output and confirm that no potential matches exceed the 50-character allowance.
src/webpack/common/components.ts (1)
41-41
: Added Checkbox component exportClean addition of the Checkbox component, following the established pattern for component exports. This makes Discord's internal Checkbox component available for use in Vencord plugins.
src/plugins/crashHandler/index.ts (1)
176-183
: Excellent addition of DevTools cleanup to crash recoveryThe new try-catch block is a solid addition to the crash recovery process, closing DevTools by dispatching a
DEV_TOOLS_SETTINGS_UPDATE
action. This follows the same pattern as other cleanup operations and properly handles errors.src/plugins/_api/dynamicImageModalApi.ts (2)
17-17
: Updated search pattern for better patch targetingThe modified
find
property now includes.contain
beforeSCALE_DOWN:
, improving the specificity of the pattern matching.
23-28
: Good addition of a new patch for dimensionless imagesAdding this new patch enhances the plugin's functionality to handle dimensionless images with the appropriate matching pattern and replacement.
src/plugins/_api/badges/index.tsx (3)
76-77
: Enhanced badge attribute handling with improved regex patternThe replacement approach using destructuring and template literals for badge properties is more robust and maintainable than the previous implementation.
81-81
: Code cleanup: Removed unnecessary spaces in replacement stringThis minor code cleanup makes the replacement string more concise without changing functionality.
86-86
: Code cleanup: Streamlined conditional replacement syntaxSimplified the replacement string by removing unnecessary spaces, making the code more maintainable.
src/webpack/webpack.ts (2)
41-41
: Added useful caching mechanism for Flux storesThe new
fluxStores
constant provides a cache for Flux stores, which will improve performance by avoiding redundant lookups.
434-450
: Significantly improved findStore implementation with cachingThis enhanced implementation of
findStore
follows a good pattern:
- First checks the cache for quick lookups
- If not found, searches through all stores and populates the cache
- Falls back to the original search method as a last resort
This change will improve performance, especially for frequently accessed stores.
src/webpack/common/types/components.d.ts (3)
19-19
: Added PointerEvent to import statement.This addition correctly imports the necessary PointerEvent type from React, which is needed for the new Checkbox component.
200-210
: New type definitions for CheckboxAligns and CheckboxTypes.Well-structured type definitions for checkbox alignment and type options that follow the component type pattern used throughout the codebase.
212-228
: Added Checkbox component type with appropriate props and static properties.The Checkbox component type is properly defined with:
- Required props: value and onChange handler (correctly typed with PointerEvent)
- Optional configuration props like align, size, shape, etc.
- Static properties for shapes, alignments, and types that follow Discord's component styling pattern
This implementation will allow for proper type checking when using the Checkbox component elsewhere in the codebase.
src/plugins/imageZoom/index.tsx (2)
168-170
: Improved ID attribute injection with better selector matching.Changed the patch to target
imageClassName:
instead of the previous pattern, which should make the ID attribute injection more reliable.
173-190
: Added new patches for dimensionless images to enhance zoom functionality.The new patch group for
.dimensionlessImage
includes three key improvements:
- Adds the plugin's ID to media elements for consistent identification
- Adds an empty onClick handler for zoomed elements, preventing potential event bubbling issues
- Removes unnecessary wrapper class that may have been interfering with the zoom functionality
These changes should improve the stability and consistency of the image zoom feature.
src/utils/types.ts (3)
29-29
: Changed import from JSX to ReactNode.Updated import to use ReactNode instead of JSX, which aligns with the changes to component return types in this file.
205-207
: Added utility function defineDefault for type-safe default values.New utility function that makes it clearer when a value is intended to be used as a default. While simple in implementation, it improves code readability by making the intention explicit.
341-343
: Enhanced component type to support async rendering and default values.Two important improvements:
- Changed the return type from
JSX.Element
toReactNode | Promise<ReactNode>
, enabling async component rendering- Added an optional
default
property to component definitionsThese changes provide more flexibility for plugin developers, especially when components need to load data asynchronously.
src/plugins/consoleJanitor/index.tsx (8)
8-12
: Imports look good, with all necessary dependencies.The additions of ErrorBoundary, Flex, Margins, defineDefault, and UI components are appropriate for implementing the new logging level configuration feature.
30-37
: Well-defined interface for log levels.The AllowLevels interface clearly defines all the supported logging levels as boolean flags, making it easy to understand and extend if needed.
39-41
: Clean props interface definition.The AllowLevelSettingProps interface properly types the setting key parameter to ensure type safety.
43-56
: Good implementation of the AllowLevelSetting component.The component correctly retrieves and updates the settings state. The capitalization of the setting name in the UI is a nice touch for better readability.
58-70
: Well-structured AllowLevelSettings component with error handling.Using ErrorBoundary is a good practice to prevent the entire plugin from crashing if this component fails. The layout with FormSection, FormTitle, and descriptive text provides a clear UI for users.
94-105
: Good implementation of the allowLevel setting.The component-based setting with appropriate defaults is well implemented. Setting error to true by default is a sensible choice since error logs are usually important.
122-123
: Updated shouldLog method with proper level checking.The method now correctly checks if the logger is explicitly allowed or if the specified log level is enabled in settings. This provides flexible control over logging.
197-204
: Patch implementation correctly uses the updated shouldLog method.The replacement now passes both the logger name and log level to the shouldLog method, enabling the new level-based filtering functionality.
.filter(([name]) => name.length > 1) | ||
) | ||
} | ||
Stores: Webpack.fluxStores |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Simplified Stores implementation by using cached fluxStores.
Good refactor that replaces a complex dynamic getter implementation with a direct reference to the cached Webpack.fluxStores
. This change:
- Improves performance by using pre-cached stores instead of dynamically constructing the object
- Simplifies the code and reduces potential points of failure
- Leverages existing functionality from the webpack module
{ | ||
find: '="FOCUS_SENSITIVE",', | ||
replacement: { | ||
match: /(?<=\.hidden]:)\i/, | ||
replace: "false" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed media viewer options visibility when zoomed.
This patch ensures that media viewer options remain visible even when zoomed in with Discord's default feature by forcing the hidden
class condition to return false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the actual issue youre addressing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Scyye The issue being addressed is that normally when you zoom into an image using Discord's built-in zoom feature, the media viewer options (like the download button, fullscreen button, etc.) disappear because Discord hides them.
This patch forces those controls to remain visible even when zoomed in, giving users better access to those options while they're examining zoomed images. Without this fix, users would have to zoom out first just to access those controls, which creates a poor user experience.
Co-authored-by: Nuckyz <[email protected]>
Summary by CodeRabbit
Chores
New Features
Improvements