amyjko / faculty

Amy's faculty webpage
Creative Commons Zero v1.0 Universal
22 stars 21 forks source link

publication URLs at https://faculty.washington.edu/ajko/publications are incorrect when filtering by tag #162

Closed lpmi-13 closed 1 year ago

lpmi-13 commented 1 year ago

I was interested in reading the publiction related to Item Bias, but I noticed that the link seemed to point to a completely different paper

URL for item bias points to family paper

I further noticed this was happening each time I used a tag at the top to filter publications (eg, assessment, studies, families). It seems like the original order of the publications influences the order in which the URL for the paper is being set. For example, on initial load, the paper "How families design and program games: a qualitative analysis of a 4-week online in-home study with a cellular-automata programming platform" is third in the list. After filtering on "assessment", "Investigating Item Bias in a CS1 exam with Differential Item Functioning" is now the third item on the list, but the URL still points to the Families paper.

I attempted to fork/clone the repo and play around with the code, but I'm not a svelte developer, and the really odd thing is that when changing things in src/profiles/Amy.ts (which I assume is the source for the data populating the frontend), a number of the other attributes (eg, "title") get immediately picked up when they're changed, but the URL issue persists.

Nearest I could tell, it has something to do with the getURL() function in src/lib/components/Paper.svelte, but I wasn't able to work out why only the URL seemed to be affected by the original order of items, and not any of the other attributes.

amyjko commented 1 year ago

Thanks for reporting! The perils of framework migrations...

In case you're curious, the issue was that the url was being computed and stored in a const, which is fine in React land, where everything is recomputed on each render, but in Svelte land, const is only computed once for a component. The right way to do this in Svelte is to make any derived state reactive using $, so it updates whenever props or dependencies change. This was actually a problem in many places, and something that didn't come up in testing since it's mostly a static site.

lpmi-13 commented 1 year ago

Ah ha! I had a sneaking suspicion that was involved, but the only thing I could think to try was make it a let, which obviously had no effect.

Thanks for the explanation of svelte-specific considerations!