diff --git a/.agents/memory/MEMORY.md b/.agents/memory/MEMORY.md index 3c2a28a..ee4a34e 100644 --- a/.agents/memory/MEMORY.md +++ b/.agents/memory/MEMORY.md @@ -1,3 +1,4 @@ - [Donate semantics](donate-semantics.md) — donations accumulate + clamp to target; a case enters the closed-loop pipeline only when fully funded. - [api-server data](api-server-data.md) — mockDb is in-memory and mutated by POST calls; restart the workflow to reset to clean seed for demos. - [EHSAN branding](ehsan-branding.md) — ehsan.sa blocks scraping; font is IBM Plex Sans Arabic (best match), currency uses new Saudi Riyal symbol via mask component. +- [EHSAN HMR context crash](ehsan-hmr-context-crash.md) — "useLanguage must be used within a LanguageProvider" with correct source = stale Fast Refresh state; restart the web workflow. diff --git a/.agents/memory/ehsan-hmr-context-crash.md b/.agents/memory/ehsan-hmr-context-crash.md new file mode 100644 index 0000000..a8f9587 --- /dev/null +++ b/.agents/memory/ehsan-hmr-context-crash.md @@ -0,0 +1,25 @@ +--- +name: EHSAN HMR context crash (false runtime error) +description: When the POC throws "useLanguage must be used within a LanguageProvider" but the source is correct, it's a stale HMR state — restart the workflow. +--- + +# "useLanguage must be used within a LanguageProvider" after edits + +If the EHSAN POC crashes with `useLanguage must be used within a LanguageProvider` +(and/or `Invalid hook call ... more than one copy of React`, or +`Cannot read properties of undefined`) **while `App.tsx` clearly wraps the tree in +`LanguageProvider` and the source is correct**, it is almost always a corrupted +Vite Fast Refresh (HMR) state, NOT a code bug. + +**Root cause:** `src/contexts/LanguageContext.tsx` exports both a component +(`LanguageProvider`) and a hook (`useLanguage`) from one file, so Vite logs +`Could not Fast Refresh ("useLanguage" export is incompatible)`. After several hot +updates the running app ends up with a duplicate React context instance and the +hook can't find the provider. + +**Fix:** restart the `artifacts/ehsan-poc: web` workflow. The built/production app +is unaffected — this is dev-only. + +**How to apply:** before editing source to "fix" such an error, confirm the current +files are actually correct (provider present, key exists); if so, just restart the +workflow instead of changing code. diff --git a/artifacts/ehsan-poc/public/opengraph.jpg b/artifacts/ehsan-poc/public/opengraph.jpg index e3c7b9f..a79711a 100644 Binary files a/artifacts/ehsan-poc/public/opengraph.jpg and b/artifacts/ehsan-poc/public/opengraph.jpg differ diff --git a/attached_assets/dawribanarWEB_1780682998494.png b/attached_assets/dawribanarWEB_1780682998494.png new file mode 100644 index 0000000..b9463cf Binary files /dev/null and b/attached_assets/dawribanarWEB_1780682998494.png differ diff --git a/attached_assets/zakatbanarWEB_1780682994527.png b/attached_assets/zakatbanarWEB_1780682994527.png new file mode 100644 index 0000000..600efff Binary files /dev/null and b/attached_assets/zakatbanarWEB_1780682994527.png differ