Skip to content

chore: fix linting errors ( Step 2 )#150

Open
milindmore22 wants to merge 2 commits into
migrate/scaffoldfrom
scaffold/lint
Open

chore: fix linting errors ( Step 2 )#150
milindmore22 wants to merge 2 commits into
migrate/scaffoldfrom
scaffold/lint

Conversation

@milindmore22

@milindmore22 milindmore22 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

What

This PR improves code consistency, reliability, and maintainability across several React components in the admin interface. It standardizes variable naming conventions, updates dependency arrays for React hooks to prevent stale closures, and simplifies error handling in asynchronous operations.

Why

These changes are necessary to ensure the React UI reacts correctly to state changes without encountering stale closures. Furthermore, standardizing to camelCase and consistently using the window namespace improves codebase readability. The PR also patches specific bugs, such as accidental site removal in the site selection logic and the leaking of sensitive error details to users during copy-to-clipboard actions.

Related Issue(s):

Covers Step2 : https://github.com/rtCamp/OnePress/issues/78
Step 1 : #149

How

  • Naming Conventions: Standardized variables to camelCase (e.g., converting setup_url to setupUrl, site_type to initialSiteType) and ensured global configuration objects consistently use the window namespace (e.g., window.OneUpdatePlugins).
  • Hook Dependencies: Updated dependency arrays in useEffect and useCallback across multiple components (PluginManager, S3Credentials, GitHubRepoToken, PluginGrid, PluginsSharing, S3ZipUploader) to include all referenced functions and variables.
  • Error Handling: Removed unused error variables in catch blocks for cleaner asynchronous code and standardized the API key copy-to-clipboard error logic to prevent leaking underlying error details to the user.
  • Bug Fixes: Corrected the filter callback variable in the site selection logic to prevent the accidental removal of all sites.
  • Performance: Refactored various functions to utilize useCallback, particularly within S3ZipUploader and GitHubRepoToken, to optimize rendering performance.

Testing Instructions

  1. Navigate to the Admin interface.
  2. Open the Site Selection interface and attempt to filter sites to ensure the list renders correctly without accidentally clearing all sites.
  3. Navigate to the API Keys / S3 Credentials / GitHub Repo Token sections.
  4. Test the Copy to Clipboard functionality for an API key. Force a failure (if possible) to verify that the UI returns a standardized error message without leaking sensitive details.
  5. Interact with the Plugin Manager, Plugin Grid, and Plugins Sharing components to verify that state updates correctly and no stale data is displayed.
  6. Perform an upload using the S3 Zip Uploader to ensure the async operations and useCallback refactoring behave as expected.

Screenshots

N/A

Additional Info

Code cleanup in catch blocks makes the overall footprint smaller. The adjustments to the useEffect arrays should drastically reduce the chance of silent UI bugs related to stale state.

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • My code is tested to the best of my abilities.
  • My code passes all lints (ESLint etc.).
  • My code has detailed inline documentation.
  • I have updated the project documentation as needed.
Open WordPress Playground Preview

…ces, and sanitize error handling across frontend components
@milindmore22
milindmore22 marked this pull request as ready for review July 3, 2026 12:26
@milindmore22 milindmore22 changed the title chore: fix linting errors (step2) chore: fix linting errors ( Step 2 ) Jul 3, 2026
@milindmore22
milindmore22 requested a review from justlevine July 7, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant