Feature/custom split improve#52
Closed
DevinByteX wants to merge 6 commits into
Closed
Conversation
…dge-to-edge@1.3.1 and react-native-legal@1.6.3, remove outdated vector icons and supports-color@5.5.0 plist files, and update xml-formatter to version 3.7.0
…plitScreen, including hooks for saving, updating, and deleting presets
…ng intermittent data loss and improve state persistence by removing redundant save logic in reducers
…ystemjs to version 7.29.4 and related dependencies in package-lock.json and yarn.lock
…TipMate v1.7.0 including app structure, navigation, state management, hooks, components, and styling details
…le using arch-skill
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Custom Split feature (presets + validation helpers + UI components) and hardens global state persistence by removing AsyncStorage side-effects from reducers and preventing initial hydration/write races.
Changes:
- Fixed AsyncStorage persistence race conditions by gating writes until hydration completes, and by removing per-reducer AsyncStorage writes in favor of a single persistence layer.
- Added Custom Split preset management + duplication detection hooks and new UI components for per-person allocation, preset cards, and a sticky footer.
- Updated tooling/artifacts: TS path aliases, dependency lockfiles, and regenerated LicensePlist / Android library metadata; added architecture documentation JSON.
Reviewed changes
Copilot reviewed 75 out of 89 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updated JS dependency resolutions (Babel-related upgrades). |
| tsconfig.json | Added @components/* and @hooks/* path aliases. |
| package-lock.json | Updated npm lock entries to align with dependency upgrades. |
| ios/TipCalculator.xcodeproj/project.pbxproj | Added build flags (legacy arch removal) and Swift explicit modules setting. |
| ios/Settings.bundle/com.mono0926.LicensePlist/xml-formatter@3.7.0.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/supports-color@5.5.0.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNWorklets.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNSVG.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNShare.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNScreens.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNReanimated.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNLocalize.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNGestureHandler.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/RNBootSplash.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/ReactNativeLegal.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/React.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/React-Core.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-octicons.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-material-design-icons.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-lucide.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-ionicons.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-foundation.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-fontawesome6.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-feather.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-vector-icons-ant-design.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-unistyles.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/HtmlToPdf.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/has-flag@3.0.0.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/escape-string-regexp@1.0.5.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/color-name@1.1.3.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/color-convert@1.9.3.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/chalk@2.4.2.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/ansi-styles@3.2.1.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@babel_highlight@7.25.9.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@babel_code-frame@7.10.4.plist | Removed outdated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-legal@1.6.3.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-is-edge-to-edge@1.3.1.plist | Updated iOS license entry content/metadata. |
| ios/Settings.bundle/com.mono0926.LicensePlist/react-native-bootsplash@7.3.1.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/node-html-parser@7.1.0.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@xmldom_xmldom@0.8.13.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@expo_plist@0.5.2.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@expo_json-file@10.0.13.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@expo_config-types@55.0.5.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@expo_config-plugins@55.0.8.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist/@callstack_licenses@0.3.1.plist | Added regenerated iOS license entry. |
| ios/Settings.bundle/com.mono0926.LicensePlist.plist | Updated iOS LicensePlist index (version bumps/removals). |
| ios/Settings.bundle/com.mono0926.LicensePlist.latest_result.txt | Updated LicensePlist generation output snapshot. |
| ios/Podfile.lock | Updated pods (RNBootSplash, ReactNativeLegal, checksums) and CocoaPods version metadata. |
| ios/license_plist.yml | Updated LicensePlist config (renames, manuals, and added excludes). |
| docs/architecture/from-arch-skill/architecture-data.json | Added architecture/flow visualization data. |
| docs/architecture/architecture.json | Added comprehensive architecture description JSON. |
| app/hooks/useSplitPresets.ts | New hook for preset selection/delete-mode behavior. |
| app/hooks/usePresetDuplication.ts | New hook for preset duplication detection + save/update/delete flows. |
| app/hooks/usePersistedReducer.ts | Added hydration guard to prevent startup overwrite races. |
| app/hooks/useCustomSplitValidation.ts | New validation hook for allocation totals and save readiness. |
| app/hooks/useCustomSplitPeople.ts | New hook managing custom split people CRUD + preset loading. |
| app/hooks/index.ts | Exported newly added custom split hooks. |
| app/context/rootReducer.ts | Ensured persisted slider configs are restored on hydration. |
| app/context/reducers.ts | Removed AsyncStorage side effects; reducers are now pure. |
| app/components/StyledCustomSplitPresetCard/index.tsx | New UI component for preset selection with delete-mode “shake”. |
| app/components/StyledCustomSplitPersonCard/index.tsx | New UI component for per-person allocation editing. |
| app/components/StyledCustomSplitFooter/index.tsx | New sticky footer component for validation + save/preset actions. |
| app/components/index.ts | Exported new custom split components. |
| android/config/libraries/xml-formatter@3.7.0.json | Updated Android OSS metadata entry. |
| android/config/libraries/supports-color@5.5.0.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/react-native-legal@1.6.3.json | Updated Android OSS metadata entry. |
| android/config/libraries/react-native-is-edge-to-edge@1.3.1.json | Added Android OSS metadata entry. |
| android/config/libraries/react-native-bootsplash@7.3.1.json | Updated Android OSS metadata entry. |
| android/config/libraries/node-html-parser@7.1.0.json | Updated Android OSS metadata entry. |
| android/config/libraries/has-flag@3.0.0.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/escape-string-regexp@1.0.5.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/color-name@1.1.3.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/color-convert@1.9.3.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/chalk@2.4.2.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/ansi-styles@3.2.1.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/@xmldom_xmldom@0.8.13.json | Updated Android OSS metadata entry. |
| android/config/libraries/@expo_plist@0.5.2.json | Updated Android OSS metadata entry. |
| android/config/libraries/@expo_json-file@10.0.8.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/@expo_json-file@10.0.13.json | Added Android OSS metadata entry. |
| android/config/libraries/@expo_config-types@55.0.5.json | Added Android OSS metadata entry. |
| android/config/libraries/@expo_config-types@54.0.10.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/@expo_config-plugins@55.0.8.json | Updated Android OSS metadata entry. |
| android/config/libraries/@callstack_licenses@0.3.1.json | Updated Android OSS metadata entry. |
| android/config/libraries/@babel_highlight@7.25.9.json | Removed outdated Android OSS metadata entry. |
| android/config/libraries/@babel_code-frame@7.10.4.json | Removed outdated Android OSS metadata entry. |
| .prd/async-storage-race-condition-fix.md | Added PRD documenting the persistence race and fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+13
to
+39
| useEffect(() => { | ||
| if ( | ||
| state.activeSplitConfig?.type === 'custom' && | ||
| state.activeSplitConfig?.customSplits && | ||
| state.savedSplitPresets.length > 0 | ||
| ) { | ||
| const currentSplits = state.activeSplitConfig.customSplits; | ||
|
|
||
| // Find a preset that matches the current config | ||
| const matchingPreset = state.savedSplitPresets.find(preset => { | ||
| if (preset.customSplits.length !== currentSplits.length) return false; | ||
|
|
||
| return preset.customSplits.every((split, index) => { | ||
| const current = currentSplits[index]; | ||
| return ( | ||
| split.allocationType === current.allocationType && | ||
| split.value === current.value && | ||
| split.name === current.name | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| if (matchingPreset) { | ||
| setActivePresetId(matchingPreset.id); | ||
| } | ||
| } | ||
| }, [state.activeSplitConfig, state.savedSplitPresets]); |
Comment on lines
+133
to
+137
| // Check if this is the last preset before dispatching | ||
| const remainingPresetsCount = state.savedSplitPresets.filter( | ||
| p => p.id !== presetToDelete, | ||
| ).length; | ||
| dispatch({ type: 'DELETE_SPLIT_PRESET', payload: presetToDelete }); |
Comment on lines
+39
to
+43
| onSaveAsNew, | ||
| onUpdatePreset, | ||
| people, | ||
| getValidationIcon, | ||
| getValidationText, |
| @@ -0,0 +1,118 @@ | |||
| import React, { useEffect } from 'react'; | |||
| import { View, Text, Pressable } from 'react-native'; | |||
Comment on lines
606
to
614
| OTHER_CPLUSPLUSFLAGS = ( | ||
| "$(OTHER_CFLAGS)", | ||
| "-DFOLLY_NO_CONFIG", | ||
| "-DFOLLY_MOBILE=1", | ||
| "-DFOLLY_USE_LIBCPP=1", | ||
| "-DFOLLY_CFG_NO_COROUTINES=1", | ||
| "-DFOLLY_HAVE_CLOCK_GETTIME=1", | ||
| "-DRCT_REMOVE_LEGACY_ARCH=1", | ||
| ); |
Comment on lines
+14
to
+20
| theme, | ||
| styles, | ||
| }: { | ||
| label: string; | ||
| isActive: boolean; | ||
| onPress: () => void; | ||
| theme: any; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.