judgeme-hydrogen-fixed 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +6 -0
- package/dist/index.mjs +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,14 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.2] - 2026-01-06
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fixed duplicate widgets appearing on initial page load
|
|
13
|
+
- Route change effect now skips first render to avoid double initialization
|
|
14
|
+
- Initial refresh is now only triggered by the script loading effect
|
|
15
|
+
- Fixed widgets not displaying on initial page load
|
|
16
|
+
- Added retry mechanism to wait for widget elements in DOM before initializing
|
|
17
|
+
|
|
8
18
|
## [1.0.1] - 2026-01-06
|
|
9
19
|
|
|
10
20
|
### Changed
|
|
21
|
+
|
|
11
22
|
- Updated documentation and GitHub repository links
|
|
12
23
|
|
|
13
24
|
## [1.0.0] - 2026-01-06
|
|
14
25
|
|
|
15
26
|
### Added
|
|
27
|
+
|
|
16
28
|
- Initial release
|
|
17
29
|
- `useJudgeme` hook with proper dependency arrays (fixing the infinite render loop bug from the original package)
|
|
18
30
|
- All Judge.me widget components:
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ function useJudgeme({
|
|
|
46
46
|
const lastPathnameRef = (0, import_react.useRef)("");
|
|
47
47
|
const rerenderTimeoutRef = (0, import_react.useRef)(null);
|
|
48
48
|
const isInitializedRef = (0, import_react.useRef)(false);
|
|
49
|
+
const initialRefreshDoneRef = (0, import_react.useRef)(false);
|
|
49
50
|
const refreshWidgets = (0, import_react.useCallback)(() => {
|
|
50
51
|
if (typeof window === "undefined") return;
|
|
51
52
|
const attemptRefresh = (retriesLeft) => {
|
|
@@ -89,6 +90,7 @@ function useJudgeme({
|
|
|
89
90
|
preloaderScript.innerText = `function jdgm_preloader(){${text}}`;
|
|
90
91
|
document.head.appendChild(preloaderScript);
|
|
91
92
|
console.log("Judge.me preloader script loaded, initializing widgets...");
|
|
93
|
+
initialRefreshDoneRef.current = true;
|
|
92
94
|
refreshWidgets();
|
|
93
95
|
}).catch((error) => {
|
|
94
96
|
console.error("Judge.me: Failed to load scripts", error);
|
|
@@ -104,6 +106,10 @@ function useJudgeme({
|
|
|
104
106
|
(0, import_react.useEffect)(() => {
|
|
105
107
|
if (typeof window === "undefined") return;
|
|
106
108
|
const normalizedPathname = location.pathname.replace(/\/$/, "") || "/";
|
|
109
|
+
if (lastPathnameRef.current === "") {
|
|
110
|
+
lastPathnameRef.current = normalizedPathname;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
107
113
|
if (lastPathnameRef.current === normalizedPathname) {
|
|
108
114
|
return;
|
|
109
115
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ function useJudgeme({
|
|
|
12
12
|
const lastPathnameRef = useRef("");
|
|
13
13
|
const rerenderTimeoutRef = useRef(null);
|
|
14
14
|
const isInitializedRef = useRef(false);
|
|
15
|
+
const initialRefreshDoneRef = useRef(false);
|
|
15
16
|
const refreshWidgets = useCallback(() => {
|
|
16
17
|
if (typeof window === "undefined") return;
|
|
17
18
|
const attemptRefresh = (retriesLeft) => {
|
|
@@ -55,6 +56,7 @@ function useJudgeme({
|
|
|
55
56
|
preloaderScript.innerText = `function jdgm_preloader(){${text}}`;
|
|
56
57
|
document.head.appendChild(preloaderScript);
|
|
57
58
|
console.log("Judge.me preloader script loaded, initializing widgets...");
|
|
59
|
+
initialRefreshDoneRef.current = true;
|
|
58
60
|
refreshWidgets();
|
|
59
61
|
}).catch((error) => {
|
|
60
62
|
console.error("Judge.me: Failed to load scripts", error);
|
|
@@ -70,6 +72,10 @@ function useJudgeme({
|
|
|
70
72
|
useEffect(() => {
|
|
71
73
|
if (typeof window === "undefined") return;
|
|
72
74
|
const normalizedPathname = location.pathname.replace(/\/$/, "") || "/";
|
|
75
|
+
if (lastPathnameRef.current === "") {
|
|
76
|
+
lastPathnameRef.current = normalizedPathname;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
73
79
|
if (lastPathnameRef.current === normalizedPathname) {
|
|
74
80
|
return;
|
|
75
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "judgeme-hydrogen-fixed",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Fixed version of @judgeme/shopify-hydrogen for Hydrogen/Oxygen. Fixes infinite refresh loops caused by installed.js and improper React hooks.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|