-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 switching budget from rollover budget to report budget and immediately back does not work #1933
Fix switching budget from rollover budget to report budget and immediately back does not work #1933
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
44f141e
to
4379c81
Compare
This works, and the code looks good to me. Will wait for another maintainer approval before merging. |
export type TitlebarContextValue = { | ||
sendEvent: (msg: string) => void; | ||
subscribe: (listener) => () => void; | ||
sendEvent: (msg: string, newBudgetType?: LocalPrefs['budgetType']) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make the 2nd parameter here not specific to budget type as we might introduce different message types in the future. We should instead convert the msg
parameter to a structured object with a type
property similar to how it is with redux actions e.g.
{
type: 'budget/switch-type',
payload: {
budgetType: newBudgetType,
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I changed that
843f236
to
8e52794
Compare
…ately back does not work
8e52794
to
06fcd46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you!
…ately back does not work (actualbudget#1933) * Fix switching budget from rollover budget to report budget and immediately back does not work * Pr Changes
Fix for #1915.
The issue was that TitlebarProvider has a pub/sub event pattern and the onTitlebarEvent listener was only set on first render of the budget screen, so the props.budgetType in the function context was always set to the original value. To fix it I pulled the logic for the new budget type out of the onTitlebarEvent function and into the tool bar component. If there was an additional budget type in the future, then the toolbar button could be changed to a drop down menu and the onTitlebarEvent function would not need to change.
This is my first pr on this project and I'm open to suggestions on a different way to fix this.