Skip to content

Revert "Only localize scripts once"#2268

Merged
Crabcyborg merged 5 commits into
masterfrom
revert-2260-run-localize-script-once
Mar 11, 2025
Merged

Revert "Only localize scripts once"#2268
Crabcyborg merged 5 commits into
masterfrom
revert-2260-run-localize-script-once

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Mar 11, 2025

Copy link
Copy Markdown
Contributor

Reverts #2260

It looks like frm_js is not getting defined. It's causing issues with the datepicker update.

I'm going to just revert this for now so it doesn't introduce issues with today's release.

@coderabbitai

coderabbitai Bot commented Mar 11, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request removes the static property used for tracking localized script locations from the FrmAppHelper class. The associated conditional logic in the localize_script method has been eliminated, so the method no longer checks if a script for a given location has already been localized. Additionally, the prepare_template_details method in the FrmFormTemplatesHelper class has been modified to remove the $plan_required variable, affecting how installation links are generated. The get_template_install_link method in the FrmFormsHelper class has also been simplified by removing the renewal link logic.

Changes

File Change Summary
classes/.../FrmAppHelper.php Removed the static property $localized_script_locations and the conditional check in localize_script that prevented re-localization based on location.
classes/.../FrmFormTemplatesHelper.php Removed the $plan_required variable in prepare_template_details, altering the parameters passed to get_template_install_link.
classes/.../FrmFormsHelper.php Removed the logic for generating a renewal link in get_template_install_link, simplifying the control flow.

Possibly related PRs

  • Only localize scripts once #2260: Introduced the static property and logic to prevent redundant localization, directly conflicting with this removal.
  • Drop resend email JS #1913: Made adjustments in the FrmAppHelper class targeting the localize_script method, thereby relating to the functionality changes in this pull request.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0a8cc2 and 1b94e6b.

📒 Files selected for processing (4)
  • classes/helpers/FrmFormTemplatesHelper.php (1 hunks)
  • classes/helpers/FrmFormTemplatesHelper.php (1 hunks)
  • classes/helpers/FrmFormTemplatesHelper.php (1 hunks)
  • classes/helpers/FrmFormsHelper.php (0 hunks)
💤 Files with no reviewable changes (1)
  • classes/helpers/FrmFormsHelper.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • classes/helpers/FrmFormTemplatesHelper.php
  • classes/helpers/FrmFormTemplatesHelper.php
  • classes/helpers/FrmFormTemplatesHelper.php
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1a9c53 and 98548f3.

⛔ Files ignored due to path filters (1)
  • .github/workflows/phpunit.yml is excluded by !**/*.yml
📒 Files selected for processing (1)
  • classes/helpers/FrmFormTemplatesHelper.php (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Inspections
classes/helpers/FrmFormTemplatesHelper.php

[error] 43-43: Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Cypress
  • GitHub Check: Run PHP Syntax inspection (8.3)
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
🔇 Additional comments (1)
classes/helpers/FrmFormTemplatesHelper.php (1)

42-43: The changes correctly include plan requirements in template link generation.

The addition of the $plan_required variable and including it in the compact() function call ensures that the template installation link has access to all necessary plan information. This change is part of the revert aimed at resolving the issue where frm_js was not being defined.

🧰 Tools
🪛 GitHub Actions: Inspections

[error] 43-43: Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)

Comment thread classes/helpers/FrmFormTemplatesHelper.php Outdated
@codecov

codecov Bot commented Mar 11, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 26.93%. Comparing base (97c4b68) to head (98548f3).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
classes/helpers/FrmFormTemplatesHelper.php 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2268      +/-   ##
============================================
+ Coverage     26.84%   26.93%   +0.08%     
- Complexity     8359     8373      +14     
============================================
  Files           129      132       +3     
  Lines         27615    27779     +164     
============================================
+ Hits           7412     7481      +69     
- Misses        20203    20298      +95     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Crabcyborg
Crabcyborg merged commit f2a3df3 into master Mar 11, 2025
@Crabcyborg
Crabcyborg deleted the revert-2260-run-localize-script-once branch March 11, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant