Skip to content

feat: add optimistic update for away status toggling#10395

Merged
sean-brydon merged 4 commits into
calcom:mainfrom
O4epegb:add-optimistic-away-update
Jul 28, 2023
Merged

feat: add optimistic update for away status toggling#10395
sean-brydon merged 4 commits into
calcom:mainfrom
O4epegb:add-optimistic-away-update

Conversation

@O4epegb

@O4epegb O4epegb commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds optimistic update for away status toggling

Fixes #7749

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

Just open dropdown user menu and toggle your away status. It should be toggled instantly/optimistically. If there is an error then the toast will be shown.

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

/claim #7749

@vercel

vercel Bot commented Jul 26, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2023 0:10am

@vercel

vercel Bot commented Jul 26, 2023

Copy link
Copy Markdown

@O4epegb is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added 1 points Created by SyncLinear.com Low priority Created by Linear-GitHub Sync ui area: UI, frontend, button, form, input ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work 💎 Bounty A bounty on Algora.io 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Jul 26, 2023
@github-actions

github-actions Bot commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@O4epegb O4epegb changed the title Add optimistic update for away status toggling feat: add optimistic update for away status toggling Jul 26, 2023
@github-actions

github-actions Bot commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

const { t } = useLocale();
const { data: user } = useMeQuery();
const { data: avatar } = useAvatarQuery();
const utils = trpc.useContext();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just moved it up top to clearly see where it comes from before using

const utils = trpc.useContext();
const [helpOpen, setHelpOpen] = useState(false);
const [menuOpen, setMenuOpen] = useState(false);
if (!user) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Duplicated check, there is already another one later on

)}
onClick={() => {
mutation.mutate({ away: !user?.away });
utils.viewer.me.invalidate();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Invalidation happens inside of mutation now

@CarinaWolli CarinaWolli requested a review from sean-brydon July 27, 2023 15:40

@sean-brydon sean-brydon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works as expected! Nice work.

@sean-brydon sean-brydon enabled auto-merge (squash) July 28, 2023 09:35

@Udit-takkar Udit-takkar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@O4epegb some E2E tests are failing

@sean-brydon

Copy link
Copy Markdown
Member

@O4epegb some E2E tests are failing

Missed this sorry!

@sean-brydon sean-brydon merged commit e833903 into calcom:main Jul 28, 2023
@O4epegb O4epegb deleted the add-optimistic-away-update branch July 28, 2023 12:31
sean-brydon added a commit that referenced this pull request Jul 31, 2023
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 points Created by SyncLinear.com 💎 Bounty A bounty on Algora.io 🧹 Improvements Improvements to existing features. Mostly UX/UI Low priority Created by Linear-GitHub Sync ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work ui area: UI, frontend, button, form, input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-1266] Improve UX on away toggle

3 participants