Hash navigation not working [TypeError: normalized[thumbIndex] is undefined]
See original GitHub issueWhen I open root initially, it works fine.
However if I try to come to specific slide externally (e.g. I want to share it), it fails to do so.
To reproduce:
<Gallery id="1">
... several Item s ...
</Gallery>
Go to: http://localhost:3000/#&gid=1&pid=12
Expected: Item with id = 12 is opened
Actual:
TypeError: normalized[thumbIndex] is undefined
getThumbBoundsFn
c:/git/src/gallery-custom.tsx:93
90 | .sort(function (_a, _b) {
91 | var _c = __read(_a, 1), a = _c[0].current;
92 | var _d = __read(_b, 1), b = _d[0].current;
> 93 | return helpers_1.sortNodes(a, b);
94 | ^ })
95 | .forEach(prepare);
96 | }
./node_modules/react-photoswipe-gallery/dist/gallery-custom.js/exports.CustomGallery/open<
c:/git/src/gallery-custom.tsx:103
100 | var layoutEl = layoutRef.current;
101 | if (layoutEl) {
102 | var instance = new photoswipe_1.default(layoutEl, ui, normalized, __assign(__assign({ index: index === null ? parseInt(targetId, 10) - 1 : index, getThumbBoundsFn: function (thumbIndex) {
> 103 | var el = normalized[thumbIndex].el;
104 | ^ return el ? helpers_1.getElBounds(el) : { x: 0, y: 0, w: 0 };
105 | }, history: false }, (galleryUID !== undefined
106 | ? { galleryUID: galleryUID, history: true }
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
reactjs - Jest error - Not implemented: navigation (except hash ...
I've worked out the problem: ... A click on an anchor is a navigation, usually, which I presume JSDom is taking ... TypeError:...
Read more >Hash-only navigation doesn't work · Issue #257 - GitHub
In short, hash navigation won't trigger any of the page initialization events. A puppeteer problem is that page.goto FORCES you to attempt to ......
Read more >Location hash Property - W3Schools
The location.hash property sets or returns the anchor part of a URL, ... When location.hash is used to set the anchor part, do...
Read more >How to load a #hash fragment to an anchor name in react ...
The solution to this problem is to make a manual process of the scroll obtaining the hash of the URL through the window.location...
Read more >HTMLAnchorElement.hash - Web APIs | MDN
The HTMLAnchorElement.hash property returns a string containing a '#' followed by the fragment identifier of the URL. The fragment is not ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/TiraelSedai/rpg-hash-nav-issue-example sure thing
I can’t reproduce the problem. Hash navigation works well for me with following code.
@TiraelSedai can you please provide more context on this? Maybe there is a very specific case, which I cannot reproduce