Skip to content

fix: require class-admin-page-svelte before reBEMer enqueue (frontend fatal) - #161

Merged
jackgranatowski merged 1 commit into
mainfrom
claude/wcag-checker-undo-batch
May 30, 2026
Merged

fix: require class-admin-page-svelte before reBEMer enqueue (frontend fatal)#161
jackgranatowski merged 1 commit into
mainfrom
claude/wcag-checker-undo-batch

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds require_once for class-admin-page-svelte.php inside slashed_bricks_rebemer_init() before instantiating Slashed_Bricks_ReBEMer_Enqueue
  • Rebuilds dist/slashed-bricks.zip

Root cause

class-rebemer-enqueue.php line 53 calls Slashed_Bricks_Admin_Page_Svelte::get_class_hints() to pass class hint data to the editor app. However class-admin-page-svelte.php was only require_once'd inside the is_admin() branch of slashed_bricks_admin_init().

The Bricks editor loads on the frontend (fires wp_enqueue_scripts via bricks_is_builder_main()), where is_admin() is false. So the class was never loaded, producing:

PHP Fatal error: Uncaught Error: Class "Slashed_Bricks_Admin_Page_Svelte" not found
in class-rebemer-enqueue.php:53

Fix

Add require_once SLASHED_BRICKS_PATH . 'includes/class-admin-page-svelte.php' in slashed_bricks_rebemer_init(), immediately before the enqueue class is required. require_once is idempotent — on admin requests where the class is already loaded, this is a no-op.

Test plan

  • Open the Bricks editor — no fatal error
  • reBEMer panel loads and class hints are available

https://claude.ai/code/session_018u9uVFxgL7K6EpPjZPggKR


Generated by Claude Code

Summary by CodeRabbit

  • Chores
    • Updated internal infrastructure for admin page handling and integration initialization.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jackgranatowski, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 19 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6136c278-7c6a-4abf-bb17-ba15086d357a

📥 Commits

Reviewing files that changed from the base of the PR and between 4aa67ec and 5fad29c.

⛔ Files ignored due to path filters (1)
  • dist/slashed-bricks.zip is excluded by !**/dist/**, !**/*.zip
📒 Files selected for processing (1)
  • integrations/bricks/slashed-bricks.php
📝 Walkthrough

Walkthrough

This PR adds a single require_once statement to the Bricks integration initialization function, loading the Admin Page Svelte class before the ReBEMer enqueue class is instantiated. The change establishes a dependency order to ensure the Svelte admin page class is available during enqueue initialization.

Changes

Bricks Integration Initialization

Layer / File(s) Summary
Admin Page Svelte class loading
integrations/bricks/slashed-bricks.php
A require_once for includes/class-admin-page-svelte.php was added to slashed_bricks_rebemer_init() before the ReBEMer enqueue class is loaded.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#157: The class-hints feature relies on the Admin Page Svelte class being available for editor localization, which this PR ensures by establishing the load order dependency.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: requiring a class file before reBEMer enqueue to fix a frontend fatal error. It is specific, concise, and directly reflects the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/wcag-checker-undo-batch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

class-rebemer-enqueue.php calls Slashed_Bricks_Admin_Page_Svelte::get_class_hints()
but that class was only required inside the is_admin() branch. The Bricks
editor runs on the frontend so is_admin() is false, causing a fatal
"Class not found" error when wp_enqueue_scripts fires.

require_once is idempotent — safe when admin already loaded the class.

https://claude.ai/code/session_018u9uVFxgL7K6EpPjZPggKR
@jackgranatowski
jackgranatowski force-pushed the claude/wcag-checker-undo-batch branch from 4aa67ec to 5fad29c Compare May 30, 2026 14:22
@jackgranatowski
jackgranatowski merged commit ce58009 into main May 30, 2026
8 checks passed
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.

2 participants