From e5f493d70d67690854cd52f26cc7adbdc8f324ee Mon Sep 17 00:00:00 2001 From: stevepodell Date: Wed, 22 Jan 2025 15:07:12 -0800 Subject: [PATCH 1/2] Got the drawers working again In some cases I fell back to code from last week, leaving newer code that was not fully working in place, but commented out. At this point every ReactQuery call works perfectly (without overriding the config values set in App.jsx) and I tested them many many times. In TeamMemberList, I revived last week's working code, and left in place the code that uses apiCache. In TeamMemberList I now do a diff to show the differences from data straight out of ReactQuery (which has matched SQL every time that I have checked it manually), with the processed data that is stored in apiCache -- there currently is a discrepancy in apiDataCache. That diff should be useful in the future, and could be generalized. I did not test or fix the Questionnaire drawer yet. This is an incremental checkin, and I'll now work on getting the apiDataCache working as it exists. (Although it would be my strong preference to get it working by using ReactQuery's internal cache as the only cache for unaltered API results, and to generate the processed output through what is now apiDataCache from the ReactQuery's internal cache.) --- src/App.jsx | 14 +- src/js/actions/PersonActions.js | 68 +- src/js/actions/TaskActions.js | 160 +- src/js/actions/TeamActions.js | 108 +- src/js/components/Drawers/AddTeamDrawer.jsx | 2 +- src/js/components/Navigation/Header.jsx | 34 +- .../Person/AddPersonDrawerMainContent.jsx | 24 +- src/js/components/Person/EditPersonForm.jsx | 18 +- src/js/components/Person/PersonSummaryRow.jsx | 17 +- src/js/components/Team/TeamHeader.jsx | 9 +- src/js/components/Team/TeamMemberList.jsx | 68 +- src/js/contexts/ConnectAppContext.jsx | 34 +- src/js/models/PersonModel.jsx | 4 +- src/js/models/TaskModel.jsx | 1 + src/js/models/TeamModel.jsx | 11 +- src/js/models/initialApiDataCache.js | 1 + src/js/pages/TeamHome.jsx | 8 +- src/js/pages/Teams.jsx | 62 +- src/js/react-query/TeamsQueryProcessing.js | 28 +- src/js/react-query/WeConnectQuery.js | 4 +- src/js/react-query/mutations.jsx | 3 +- src/js/stores/AppObservableStore.js | 1840 ++++++++--------- src/js/stores/PersonStore.js | 592 +++--- src/js/stores/TaskStore.js | 1056 ++++++---- src/js/stores/TeamStore.js | 564 ++--- src/js/utils/cordovaUtilsPageEnumeration.js | 7 +- 26 files changed, 2528 insertions(+), 2209 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index facddb3..cd71e3c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -38,11 +38,11 @@ function App () { const [showDevtools] = useState(webAppConfig.ENABLE_REACT_QUERY_TOOLS !== undefined ? webAppConfig.ENABLE_REACT_QUERY_TOOLS : true); - // Inject this once for the app, for all react-query queries + // Inject this once for the app, then it is the default for all ReactQuery queries const queryClient = new QueryClient({ defaultOptions: { queries: { - networkMode: 'always', // Send queries to the server even if the cache has the data + // networkMode: 'always', // <-- This is not a solution, it just covers up some problem in our code, while disabling the biggest benefit of ReactQueries. Send queries to the server even if the cache has the data refetchOnWindowFocus: false, refetchOnMount: true, staleTime: 1000 * 60 * 5, // 5 minutes @@ -53,19 +53,13 @@ function App () { useEffect(() => { console.log('--------- App.jsx loading ---------'); initializejQuery(() => { - console.log('--------- jQuery has been initialized ---------'); + console.log('--------- jQuery has been initialized, indicates that a new session has been created ---------'); }); return () => { // Anything in here is fired on component unmount, equiv to componentDidUnmount() }; }, []); - - const isAuth = localStorage.getItem('isAuthenticated'); - if (isAuth) { - console.log('======================================== isAuthenticated: " ', isAuth, ' ============================='); - } - return ( <> @@ -92,7 +86,7 @@ function App () { } /> } /> - {/* Hack 1/14/25