Skip to content

Commit

Permalink
Merge branch 'master' into centralize-use-meta-theme-color
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-fidd authored Sep 28, 2024
2 parents 3be90b6 + 545c8d5 commit 74eb106
Show file tree
Hide file tree
Showing 21 changed files with 309 additions and 359 deletions.
1 change: 1 addition & 0 deletions .github/workflows/electron-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
python3 -m pip install setuptools
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get install flatpak -y
sudo apt-get install flatpak-builder -y
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/electron-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
python3 -m pip install setuptools
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get install flatpak -y
sudo apt-get install flatpak-builder -y
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getFieldError,
unparse,
FIELD_TYPES,
TYPE_INFO,
getValidOps,
} from 'loot-core/src/shared/rules';
import { titleFirst } from 'loot-core/src/shared/util';

Expand Down Expand Up @@ -77,7 +77,7 @@ function ConfigureField({
}, [op]);

const type = FIELD_TYPES.get(field);
let ops = TYPE_INFO[type].ops.filter(op => op !== 'isbetween');
let ops = getValidOps(field).filter(op => op !== 'isbetween');

// Month and year fields are quite hacky right now! Figure out how
// to clean this up later
Expand Down Expand Up @@ -259,7 +259,7 @@ export function FilterButton({ onApply, compact, hover, exclude }) {
case 'configure': {
const { field } = deserializeField(action.field);
const type = FIELD_TYPES.get(field);
const ops = TYPE_INFO[type].ops;
const ops = getValidOps(field);
return {
...state,
fieldsOpen: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function updateFilterReducer(
switch (action.type) {
case 'set-op': {
const type = FIELD_TYPES.get(state.field);
let value = state.value;
let value: RuleConditionEntity['value'] | null = state.value;
if (
(type === 'id' || type === 'string') &&
(action.op === 'contains' ||
Expand Down
10 changes: 6 additions & 4 deletions packages/desktop-client/src/components/modals/EditRuleModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ import {
unparse,
makeValue,
FIELD_TYPES,
TYPE_INFO,
ALLOCATION_METHODS,
isValidOp,
getValidOps,
} from 'loot-core/src/shared/rules';
import {
integerToCurrency,
Expand Down Expand Up @@ -580,14 +581,15 @@ function ConditionsList({
if (
(prevType === 'string' || prevType === 'number') &&
prevType === newCond.type &&
cond.op !== 'isbetween'
cond.op !== 'isbetween' &&
isValidOp(newCond.field, cond.op)
) {
// Don't clear the value & op if the type is string/number and
// the type hasn't changed
newCond.op = cond.op;
return newInput(makeValue(cond.value, newCond));
} else {
newCond.op = TYPE_INFO[newCond.type].ops[0];
newCond.op = getValidOps(newCond.field)[0];
return newInput(makeValue(null, newCond));
}
} else if (field === 'op') {
Expand Down Expand Up @@ -654,7 +656,7 @@ function ConditionsList({
) : (
<Stack spacing={2} data-testid="condition-list">
{conditions.map((cond, i) => {
let ops = TYPE_INFO[cond.type].ops;
let ops = getValidOps(cond.field);

// Hack for now, these ops should be the only ones available
// for recurring dates
Expand Down
6 changes: 4 additions & 2 deletions packages/desktop-client/src/components/util/LoadComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function LoadComponentInner<K extends string>({
localModuleCache.get(name) ?? null,
);
const [failedToLoad, setFailedToLoad] = useState(false);
const [failedToLoadException, setFailedToLoadException] = useState(null);

useEffect(() => {
if (localModuleCache.has(name)) {
Expand All @@ -55,13 +56,14 @@ function LoadComponentInner<K extends string>({
{
retries: 5,
},
).catch(() => {
).catch(e => {
setFailedToLoad(true);
setFailedToLoadException(e);
});
}, [name, importer]);

if (failedToLoad) {
throw new LazyLoadFailedError(name);
throw new LazyLoadFailedError(name, failedToLoadException);
}

if (!Component) {
Expand Down
14 changes: 8 additions & 6 deletions packages/desktop-client/src/gocardless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export async function authorizeBank(
) {
_authorize(dispatch, upgradingAccountId, {
onSuccess: async data => {
pushModal('select-linked-accounts', {
accounts: data.accounts,
requisitionId: data.id,
upgradingAccountId,
syncSource: 'goCardless',
});
dispatch(
pushModal('select-linked-accounts', {
accounts: data.accounts,
requisitionId: data.id,
upgradingAccountId,
syncSource: 'goCardless',
}),
);
},
});
}
Loading

0 comments on commit 74eb106

Please sign in to comment.