Skip to content

Fix React hooks ReferenceError crashing MARBOHUB POS after login - #14

Draft
thetigerone888 with Copilot wants to merge 2 commits into
mainfrom
copilot/tham
Draft

Fix React hooks ReferenceError crashing MARBOHUB POS after login#14
thetigerone888 with Copilot wants to merge 2 commits into
mainfrom
copilot/tham

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown

The MARBOHUB POS app was completely non-functional after login — the bundled app code references useState, useEffect, useRef, and useMemo as bare globals, but the React 18 CDN UMD build only exposes window.React and window.ReactDOM, leaving those hooks undefined.

Change

  • marbohub-pos/index.html — add Object.assign(window, React) in loadApp()'s s2.onload callback, immediately after react-dom loads and before the bundled app script is injected:
s2.onload = function() {
  // React loaded → expose hooks as globals so bundled app code can call them directly
  Object.assign(window, React);
  var s3 = document.createElement("script");
  s3.id = "app-js";
  s3.textContent = document.getElementById("app-src").textContent;
  document.body.appendChild(s3);
};

This promotes all React exports onto window, resolving the ReferenceError: useState is not defined crash and allowing the dashboard to render.

Copilot AI linked an issue Jul 28, 2026 that may be closed by this pull request
Closed
Copilot AI changed the title [WIP] Resolve issue related to THAM Fix React hooks ReferenceError crashing MARBOHUB POS after login Jul 28, 2026
Copilot AI requested a review from thetigerone888 July 28, 2026 02:38
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.

THAM

2 participants