Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: redirect to home page after posting a highlight #203

Conversation

marcusgchan
Copy link
Contributor

@marcusgchan marcusgchan commented Jul 11, 2023

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Description

This PR redirects the users to the home page after creating a highlight.

Related Tickets & Documents

Fixes #178

Mobile & Desktop Screenshots/Recordings

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

  • πŸ“œ README.md
  • πŸ““ docs.opensauced.pizza
  • πŸ• dev.to/opensauced
  • πŸ“• storybook
  • πŸ™… no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

@marcusgchan marcusgchan changed the title fix: redirect to home page after posting a highligh fix: redirect to home page after posting a highlight Jul 11, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks Passed!

@marcusgchan marcusgchan force-pushed the fix/redirect-to-home-after-posting-highlight branch from d348f6d to f0a5060 Compare July 17, 2023 21:18
@marcusgchan marcusgchan force-pushed the fix/redirect-to-home-after-posting-highlight branch from f0a5060 to b71005c Compare July 19, 2023 19:00
@marcusgchan
Copy link
Contributor Author

marcusgchan commented Jul 19, 2023

One thing i noticed is the highlights aren't updated immediately on the home page of the extension because I think it's cached. Is there a function i can call to invalidate or update the cache?

@marcusgchan
Copy link
Contributor Author

Or do you think it's fine to let it update once it expires

@Anush008
Copy link
Member

You are correct. The highlights are cached for 300 seconds.

useEffect(() => {
const fetchHighlights = async () => {
try {
const userHighlightsData = await getHighlights();

export const getHighlights = async (): Promise<Highlights | undefined> => {
const response = await cachedFetch(
`${OPEN_SAUCED_HIGHLIGHTS_LIST_ENDPOINT}?limit=10`,
{
method: "GET",
expireInSeconds: 300,
},
);
if (!response) {
return;
}
return response.json();
};

The cachedFetch() can accepts a forceRefresh bool to invalidate the cache.

@Anush008
Copy link
Member

Anush008 commented Jul 19, 2023

We can parameterize the Home component with a forceRefresh value, defaulting to false, that can be passed when navigating to it. Like so

goTo(Profile, { username: user.user_name });

The value will govern whether to do a force refresh when getting the highlights. The getHighlights() will need an update for the forceRefresh argument.

@marcusgchan
Copy link
Contributor Author

Thanks for the detailed overview!

@marcusgchan marcusgchan marked this pull request as ready for review July 19, 2023 20:59
Copy link
Member

@Anush008 Anush008 left a comment

Choose a reason for hiding this comment

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

Great. Thanks for working on this @marcusgchan.

@bdougie bdougie merged commit 4ebd2d1 into open-sauced:beta Jul 20, 2023
github-actions bot pushed a commit that referenced this pull request Jul 20, 2023
## [1.12.0-beta.3](v1.12.0-beta.2...v1.12.0-beta.3) (2023-07-20)

### πŸ› Bug Fixes

* redirect to home page after posting a highlight ([#203](#203)) ([4ebd2d1](4ebd2d1))
@github-actions
Copy link

πŸŽ‰ This PR is included in version 1.12.0-beta.3 πŸŽ‰

The release is available on GitHub release

Your semantic-release bot πŸ“¦πŸš€

zer0and1 pushed a commit to zer0and1/open-sauced.ai that referenced this pull request Jul 26, 2023
## [1.12.0-beta.3](open-sauced/ai@v1.12.0-beta.2...v1.12.0-beta.3) (2023-07-20)

### πŸ› Bug Fixes

* redirect to home page after posting a highlight ([#203](open-sauced/ai#203)) ([4ebd2d1](open-sauced/ai@4ebd2d1))
@bdougie bdougie mentioned this pull request Jul 31, 2023
bdougie added a commit that referenced this pull request Jul 31, 2023
* feat: view repos on opensauced (#218)

* feat: view repos on opensauced

* change var names

* chore(minor): release 1.12.0-beta.1 on beta channel [skip ci]

## [1.12.0-beta.1](v1.11.1...v1.12.0-beta.1) (2023-07-18)

### πŸ• Features

* view repos on opensauced ([#218](#218)) ([f33d9fd](f33d9fd))

* fix: post highlights from the extension (#223)

* chore(patch): release 1.12.0-beta.2 on beta channel [skip ci]

## [1.12.0-beta.2](v1.12.0-beta.1...v1.12.0-beta.2) (2023-07-19)

### πŸ› Bug Fixes

* post highlights from the extension ([#223](#223)) ([7d91011](7d91011))

* fix: redirect to home page after posting a highlight (#203)

* fix: redirect to home page after posting a highligh

* Added forceRefresh param to force cache invalidation

* chore: default val forceRefresh, typo

---------

Co-authored-by: Anush008 <[email protected]>

* chore(patch): release 1.12.0-beta.3 on beta channel [skip ci]

## [1.12.0-beta.3](v1.12.0-beta.2...v1.12.0-beta.3) (2023-07-20)

### πŸ› Bug Fixes

* redirect to home page after posting a highlight ([#203](#203)) ([4ebd2d1](4ebd2d1))

* fix: view on open sauced location (#225)

* bug-fix: view on open sauced location

* fix: change classname to constant name

* fix: remove unwanted lint changes in constants

* feat: change variable name

* fix: remove element cast

Co-authored-by: Nick Taylor <[email protected]>

---------

Co-authored-by: Nick Taylor <[email protected]>

* chore(patch): release 1.12.0-beta.4 on beta channel [skip ci]

## [1.12.0-beta.4](v1.12.0-beta.3...v1.12.0-beta.4) (2023-07-25)

### πŸ› Bug Fixes

* view on open sauced location ([#225](#225)) ([0ecfef0](0ecfef0))

* feat: Login with pkce (#230)

* chore(minor): release 1.12.0-beta.5 on beta channel [skip ci]

## [1.12.0-beta.5](v1.12.0-beta.4...v1.12.0-beta.5) (2023-07-28)

### πŸ• Features

* Login with pkce ([#230](#230)) ([42e8d4a](42e8d4a))

---------

Co-authored-by: Divyansh Singh <[email protected]>
Co-authored-by: Marcus Chan <[email protected]>
Co-authored-by: Anush008 <[email protected]>
Co-authored-by: Pratham <[email protected]>
Co-authored-by: Nick Taylor <[email protected]>
github-actions bot pushed a commit that referenced this pull request Jul 31, 2023
## [1.12.0](v1.11.1...v1.12.0) (2023-07-31)

### πŸ• Features

* Login with pkce ([#230](#230)) ([42e8d4a](42e8d4a))
* view repos on opensauced ([#218](#218)) ([f33d9fd](f33d9fd))

### πŸ› Bug Fixes

* manual release.yml ([a41de3f](a41de3f))
* post highlights from the extension ([#223](#223)) ([7d91011](7d91011))
* redirect to home page after posting a highlight ([#203](#203)) ([4ebd2d1](4ebd2d1))
* view on open sauced location ([#225](#225)) ([0ecfef0](0ecfef0))
@github-actions
Copy link

πŸŽ‰ This PR is included in version 1.12.0 πŸŽ‰

The release is available on GitHub release

Your semantic-release bot πŸ“¦πŸš€

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

Successfully merging this pull request may close these issues.

Bug: after posting highlight, the screen doesn't redirect
4 participants