Describe the bug
Merchant sightings are being overwritten over a period of time when the client receives additional data, leaving the page to assume that there were no sightings. The data being pulled is correct when the client loads the data in for the first time.
To Reproduce
Steps to reproduce the behavior:
- Open the merchants page any time while the merchants are active (this is more apparent if done right as the merchants spawn and no data is present)
- Leave it open without refreshing or modifying any settings
Expected behavior
All of the merchants that have votes remain on the page throughout the entire window
Screenshots
I wasn't able to take a screenshot of the page by the time they disappeared, but I took notes of the WebSocket data in Additional Context below
Desktop (please complete the following information):
- OS: Windows
- Browser: Edge (Chrome)
- Version: 101.0.1210.47
Additional context
I think the problem is in pages/merchants.tsx
and is caused when the page merges the merchantAPIData
and apiData
after it receives new data from SaintBot. The keys from apiData
overwrites the values that are present in merchantAPIData
.
An observation of the WebSocket data for US East, Azena on 2022-05-21 from 17:38 to 17:55 EDT:
Time |
WebSocket Data |
Notes |
17:38 |
- Oliver
- Jeffrey (1 item)
- Jeffrey (2 items)
- Nox
- Malone
- Morris
|
First loaded the page at 17:38 with this payload |
17:38 |
- Jeffrey (2 items)
|
A second vote for Jeffrey with a corrected list of good items. The entry for Oliver gets overwritten and disappears |
17:39 |
- Lucas
|
A vote for Lucas The first entry for Jeffrey is overwritten, but still appears because of the redundant entries |
17:40 |
- Mac
- Mac
|
Two votes for Mac. Lucas and Jeffrey are now overwritten. Jeffrey at index 2 still has data and remains listed
|
17:41 |
- Rayni
|
A vote for Rayni at Starsand Beach The first Mac entry gets overwritten |
17:42 |
- Rayni
|
A vote for Rayni at Secret Forest, overriding the vote for Starsand Beach |
17:46 |
- Dorella
|
A vote for Dorella Rayni was overwritten |
17:49 |
- Rayni
|
The WebSocket resends the info for Rayni Dorella was overwritten |
17:50 |
- Aricer
|
A vote for Aricer Rayni was overwritten |
17:51 |
- Burt
|
A vote for Burt Aricer was overwritten |
The final data stack and what we ultimately see on the website before the merchants packed up shop for the hour:
- Burt
- Mac
- Jeffrey
- Nox
- Malone
- Morris
Oliver, Lucas, Rayni, Dorella, and Aricer all report "Unknown" on the website because their keys were overwritten.
Screenshot of all the votes that were logged on SaintBot