fix: require class-admin-page-svelte before reBEMer enqueue (frontend fatal) - #161
Conversation
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a single ChangesBricks Integration Initialization
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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
4aa67ec to
5fad29c
Compare
Summary
require_onceforclass-admin-page-svelte.phpinsideslashed_bricks_rebemer_init()before instantiatingSlashed_Bricks_ReBEMer_Enqueuedist/slashed-bricks.zipRoot cause
class-rebemer-enqueue.phpline 53 callsSlashed_Bricks_Admin_Page_Svelte::get_class_hints()to pass class hint data to the editor app. Howeverclass-admin-page-svelte.phpwas onlyrequire_once'd inside theis_admin()branch ofslashed_bricks_admin_init().The Bricks editor loads on the frontend (fires
wp_enqueue_scriptsviabricks_is_builder_main()), whereis_admin()isfalse. So the class was never loaded, producing:Fix
Add
require_once SLASHED_BRICKS_PATH . 'includes/class-admin-page-svelte.php'inslashed_bricks_rebemer_init(), immediately before the enqueue class is required.require_onceis idempotent — on admin requests where the class is already loaded, this is a no-op.Test plan
https://claude.ai/code/session_018u9uVFxgL7K6EpPjZPggKR
Generated by Claude Code
Summary by CodeRabbit