Skip to content

Conversation

@PoorBillyPilgrim
Copy link
Contributor

Description

Previously, users were directed away from the web catalog to view web readers provided by distributors. We will now keep users within the app by rendering any provided web reader URL within an embedded iframe. While we cannot control how distributors decide to render their viewers nor can we control how errors will be rendered, any errors will be non-blocking and users will have the ability to exit the screen and return the web catalog.

Motivation and Context

This change provides a more integrated experience for users by keeping them within the app.

Jira PP-3296

How Has This Been Tested?

Added tests to ensure the loading and loaded states render properly. Also manually tested loans that successfully and unsuccessfully loaded within the iframe to see how the app handled those scenarios.

Checklist:

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks pretty good. I've put a first round of comments up. I do have a few security concerns, but I think we can address those after a round or two of deployed testing.

if (credentials.token?.expirationDate) {
return isBefore(credentials?.token?.expirationDate, new Date());
}
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has the check been removed here? Testing, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a period of time away, I would try to read the book and would get a invalid token error. The useSWR hook wasn't revalidating my loans and thus was not refreshing my token. I removed the check so that the token would refresh more often and ensure a valid one was available.

I couldn't figure out why there was inconsistency. The logic on the check seemed correct. It would refresh that token an hour after it was created and continue to keep me signed in.

I should make a ticket to dig deeper.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use some tests here for navigation behavior (back button, onclose goes back, correct readUrl, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, I'll add some more.

* ensure navigation works as expected
* ensure url provided to external reader has been parsed and is valid, otherwise show 404
@coveralls
Copy link

Pull Request Test Coverage Report for Build 21071628637

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 77.108%

Totals Coverage Status
Change from base Build 20721882785: 0.0%
Covered Lines: 71
Relevant Lines: 92

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants