SunsetFi / bookofhours-catalog

Real time cataloging UI for Book of Hours, built on the Secret Histories REST API
6 stars 2 forks source link

React Error When sorting in Craftables tab #3

Closed ErwanLeroux closed 4 weeks ago

ErwanLeroux commented 1 month ago

When I try to sort craftables with any criteria, I get a white page with an error in the console :

Uncaught Error: Minified React error #300; visit https://reactjs.org/docs/error-decoder.html?invariant=300 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    Pu http://localhost:8081/catalogue/assets/react-75ea4ae3.js:30
    Do http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    ac http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    uc http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    Md http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    Wr http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    Ko http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    qi http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    pt http://localhost:8081/catalogue/assets/react-75ea4ae3.js:30
    ce http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    ce http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    Te http://localhost:8081/catalogue/assets/react-75ea4ae3.js:32
    gd http://localhost:8081/catalogue/assets/react-75ea4ae3.js:30
    call http://localhost:8081/catalogue/assets/vendor-3d71d168.js:2
    call http://localhost:8081/catalogue/assets/vendor-3d71d168.js:2
    _ http://localhost:8081/catalogue/assets/vendor-3d71d168.js:2
    N http://localhost:8081/catalogue/assets/vendor-3d71d168.js:2
    r http://localhost:8081/catalogue/assets/index-f538e405.js:1
    r http://localhost:8081/catalogue/assets/index-f538e405.js:1
    I http://localhost:8081/catalogue/assets/index-f538e405.js:1
    setSorting http://localhost:8081/catalogue/assets/vendor-3d71d168.js:15
    toggleSorting http://localhost:8081/catalogue/assets/vendor-3d71d168.js:15
    getToggleSortingHandler http://localhost:8081/catalogue/assets/vendor-3d71d168.js:15
    ...

Reproductible using this url : http://localhost:8081/catalogue#/craftables?sort-by=%5B%7B%22id%22%3A%22aspects%22%2C%22desc%22%3Atrue%7D%5D

SunsetFi commented 1 month ago

Hey, just letting you know I've seen this. I haven't had a chance to work on this recently thanks to a broken laptop but hopefully this weekend I can dig into it. It should be simple to track down and fix.

Will update this issue as I make progress.

ErwanLeroux commented 1 month ago

Thank you for your reply ! I kinda already solved the issue by removing React.useMemo() in crafting-data-source.ts

I'm not sure that's a good fix but it solved my immediate problem.

Please don't rush on my behalf, take the time you need, what you made is already super useful to use :)

SunsetFi commented 4 weeks ago

Sorry it took a bit. Your workaround is in fact the correct fix. The whole function is already memoized, so the nested memo inside of that is invalid and was causing the crash.

I see I have an unfinished FIXME in here about showing craftables for skills you no longer have. I'll fix that one too, and get a new release out 'soon'.

ErwanLeroux commented 3 weeks ago

Thank you !