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

[refactor] Migrate Discover schedules to tsx #1946

Merged

Conversation

muhsinkamil
Copy link
Contributor

Relates to #1483

  • Migrate Discover schedules component to ts
  • Enrich types to the endpoint schedules/discover

Copy link

netlify bot commented Nov 21, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 8eeb6e1
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6562e9bee45fc70008ea7603
😎 Deploy Preview https://deploy-preview-1946.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Nov 21, 2023

Bundle Stats — desktop-client

Hey 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

Files count Total bundle size % Changed
16 2.98 MB → 2.98 MB (-1 B) -0.00%
Changeset
File Δ Size
src/components/schedules/DiscoverSchedules.tsx 🆕 +8.26 kB 0 B → 8.26 kB
../loot-core/src/client/reducers/budgets.ts 📉 -66 B (-1.36%) 4.75 kB → 4.69 kB
src/components/schedules/DiscoverSchedules.js 🔥 -8.22 kB (-100%) 8.22 kB → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
static/js/main.js 1.16 MB → 1.16 MB (-1 B) -0.00%

Unchanged

Asset File Size % Changed
static/js/665.chunk.js 824.28 kB 0%
static/media/Inter-italic.var.woff2 239.29 kB 0%
static/media/Inter-roman.var.woff2 221.86 kB 0%
static/js/444.chunk.js 156.11 kB 0%
static/js/wide-components.chunk.js 119.83 kB 0%
static/js/231.chunk.js 117.37 kB 0%
static/js/reports.chunk.js 74.89 kB 0%
static/js/narrow-components.chunk.js 52.88 kB 0%
static/js/301.chunk.js 13.31 kB 0%
static/js/473.chunk.js 13 kB 0%
static/js/resize-observer-polyfill.chunk.js 8.88 kB 0%
static/css/main.css 7.41 kB 0%
asset-manifest.json 2.07 kB 0%
index.html 1.66 kB 0%
static/media/browser-server.js 911 B 0%

Copy link
Contributor

github-actions bot commented Nov 21, 2023

Bundle Stats — loot-core

Hey 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

Files count Total bundle size % Changed
2 2.22 MB → 2.22 MB (+2 B) +0.00%
Changeset
File Δ Size
packages/loot-core/src/server/schedules/find-schedules.ts 📈 +2 B (+0.02%) 11.43 kB → 11.43 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.23 MB → 1.23 MB (+2 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
xfo.xfo.kcab.worker.js 1014.46 kB 0%

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

👋 Exciting to see the TypeScript migration coming along. Thanks for your work on this! I pointed out some things that we should work on fixing, but apart from that LGTM!

packages/loot-core/src/server/schedules/find-schedules.ts Outdated Show resolved Hide resolved
payee: PayeeEntity['id'];
date: ScheduleEntity['_date'];
amount: ScheduleEntity['_amount'];
_conditions: [
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think, it should be an array of values instead, because these values are hard-coded in the same order in the return of find-schedules and if we change to enum, we get error in there that the source has 4 elements but target allows only 1

Screenshot 2023-11-22 at 1 07 46 PM

Copy link
Member

Choose a reason for hiding this comment

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

Currently it's 4 objects, but this might change to more or less in the future. We shouldn't tie the typings to the actual business logic.

Eventually I think we'll even get rid of this Conditions typing and instead use a generic one across the entire product. But it'll take us some time to get there.. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shouldn't tie the typings to the actual business logic

Agree !!, however, doing it in (_conditions: Array<A | B | C>) is not working here, what other ways would you suggest here 🤔 ? or should we keep it as Array<A | B | C> for now to change it in future ?

Copy link
Member

Choose a reason for hiding this comment

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

@trafico-bot trafico-bot bot added ⚠️ Changes requested Pull Request needs changes before it can be reviewed again 🔍 Ready for Review and removed 🔍 Ready for Review ⚠️ Changes requested Pull Request needs changes before it can be reviewed again labels Nov 21, 2023
@muhsinkamil muhsinkamil force-pushed the refactor/1483-discover-schedules branch from d9b8c03 to ecad163 Compare November 22, 2023 07:29
Comment on lines 42 to 54
{ op: 'is'; field: 'account'; value: AccountEntity['id'] },
{ op: 'is'; field: 'payee'; value: PayeeEntity['id'] },
{
op: 'is' | 'isapprox';
field: 'date';
value: ScheduleEntity['_date'];
},
{
op: 'is' | 'isapprox';
field: 'amount';
value: ScheduleEntity['_amount'];
},
];
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
{ op: 'is'; field: 'account'; value: AccountEntity['id'] },
{ op: 'is'; field: 'payee'; value: PayeeEntity['id'] },
{
op: 'is' | 'isapprox';
field: 'date';
value: ScheduleEntity['_date'];
},
{
op: 'is' | 'isapprox';
field: 'amount';
value: ScheduleEntity['_amount'];
},
];
_conditions: Array<
| { op: 'is'; field: 'account'; value: AccountEntity['id'] }
| { op: 'is'; field: 'payee'; value: PayeeEntity['id'] }
| {
op: 'is' | 'isapprox';
field: 'date';
value: ScheduleEntity['_date'];
}
| {
op: 'is' | 'isapprox';
field: 'amount';
value: ScheduleEntity['_amount'];
}
>;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you !

Copy link
Member

@MatissJanis MatissJanis Nov 25, 2023

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah !, My bad !!, Thank you :) 👍

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

Thanks so much!

@MatissJanis MatissJanis merged commit c3a9b4d into actualbudget:master Nov 26, 2023
18 of 19 checks passed
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved labels Nov 26, 2023
FlorianLang06 pushed a commit to FlorianLang06/actual that referenced this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants