Skip to content

Use is mounted hook#295

Open
Jl5her wants to merge 3 commits intomasterfrom
use-is-mounted-hook
Open

Use is mounted hook#295
Jl5her wants to merge 3 commits intomasterfrom
use-is-mounted-hook

Conversation

@Jl5her
Copy link
Member

@Jl5her Jl5her commented Oct 21, 2023

Description

Reduce duplicated code around the application with the isMounted check, each component and page having to implement the logic itself. This new hook will set the mounted status automatically and make implementing a lot easier.

Type of change

  • 🧹 Code Cleanup

How Has This Been Tested?

  • Tested individually.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.
  • My changes do not break any features.

@Jl5her Jl5her requested a review from brad-cooley as a code owner October 21, 2023 22:53

const Navigation = (props: Props): React.JSX.Element => {
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change


const ClarificationPage = (): React.JSX.Element => {
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

const Home = (): React.JSX.Element => {
usePageTitle("Abacus | Admin")
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change


const Home = (): React.JSX.Element => {
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change


const Countdown = (): React.JSX.Element => {
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

const Home = (): React.JSX.Element => {
usePageTitle("Abacus | Proctor Dashboard")
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change


const Problem = (): React.JSX.Element => {
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

const Problems = (): React.JSX.Element => {
usePageTitle("Abacus | Proctor Problems")
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

const Submission = (): React.JSX.Element => {
usePageTitle("Abacus | Judge Submission")
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

const Submissions = (): React.JSX.Element => {
usePageTitle("Abacus | Proctor Submissions")
const isMounted = useIsMounted()

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

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.

2 participants