Fix issue with card preview links disappearing #7014
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This happens very frequently to me where the preview links just stop working after a refresh or accidental horizontal scroll turns into a browser back. This is especially difficult for new players who as runners are only able to see an installed unrezzed card via the preview link when trashing.
I think I've narrowed the issue down to a race condition where the card data isn't loaded yet when the checking functions are memoized and so further invocations don't contain the card data - I was able to reproduce this very consistently by deleting the cards from local storage and throttling the browser requests.
The attached video shows the very simple fix of passing the card loaded state to the memoized function to ensure memoization remains but allows for refresh when cards are loaded.
preview-refresh-720.mov