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

Upgrade React Router #1349

Merged
merged 116 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
2e8fc0c
ProductMenu: Don't use routes
labkey-alan Nov 14, 2023
560ea51
NavigationBar: Don't use routes from React Router
labkey-alan Nov 15, 2023
f760b01
Remove react-router, add react-router-dom, remove history
labkey-alan Nov 15, 2023
46321d8
ProductMenu: improve helpers
labkey-alan Nov 15, 2023
09a725b
Don't export Location
labkey-alan Nov 15, 2023
783108a
Add withRouterDeprecated
labkey-alan Nov 15, 2023
7c3a24b
Temporarily disable useRouteLeave
labkey-alan Nov 15, 2023
61e0715
Query pages: use RR hooks
labkey-alan Nov 15, 2023
1666c3f
SubNav/NavItem: use RR hooks
labkey-alan Nov 15, 2023
9733f72
ProductMenu: use RR hooks
labkey-alan Nov 15, 2023
2a2c9cd
ProfilePage: don't use withRouter
labkey-alan Nov 15, 2023
0d1e4cf
AuditQueriesListingPage: Use RR hooks
labkey-alan Nov 15, 2023
cc2394c
UsersGridPanel: Use RR hooks
labkey-alan Nov 15, 2023
d4f08ed
URL.ts: Update util methods to use setURLSearchParams instead of rout…
labkey-alan Nov 15, 2023
a595b21
mockUtils: Update createMockRouterProps to make a DeprecatedRouter
labkey-alan Nov 15, 2023
d7300b2
CreateProjectPage: Use RR hooks
labkey-alan Nov 15, 2023
307c744
ProjectManagementPage: use RR hooks
labkey-alan Nov 15, 2023
ce933b1
PermissionAssignments: Use RR hooks
labkey-alan Nov 15, 2023
d11f824
PipelineJobsListingPage: Don't use RR types
labkey-alan Nov 15, 2023
8ae9da8
NavigationBar: Use RR hooks
labkey-alan Nov 15, 2023
6ab56a4
withQueryModels/QueryModel: use withRouterDeprecated and QueryParams
labkey-alan Nov 15, 2023
c4762ef
ReportList: Don't use react-router
labkey-alan Nov 15, 2023
0393ba3
DeprecatedRouter: add setRouteLeaveHook
labkey-alan Nov 15, 2023
415dbf6
withAssayModelsFromLocation: use RR hooks
labkey-alan Nov 15, 2023
670cb5d
LineageGridDisplay: Use RR hooks
labkey-alan Nov 15, 2023
9646364
samples/actions: Use DeprecatedLocation
labkey-alan Nov 15, 2023
22bb681
GroupAssignments/GroupManagementPage: Use RR hooks
labkey-alan Nov 15, 2023
0a8f0ea
Don't export UsersGridPanel, PermissionAssignments
labkey-alan Nov 15, 2023
9d83682
UsersGridPanel: fix types
labkey-alan Nov 15, 2023
def8293
Update release notes
labkey-alan Nov 15, 2023
2ee79d1
Remove resetParameters
labkey-alan Nov 15, 2023
a498b02
Export getQueryParams, and all types from routerTypes
labkey-alan Nov 15, 2023
eb6c30f
getSelectedSampleIdsFromSelectionKey: use URLSearchParams
labkey-alan Nov 16, 2023
455745e
getGridIdsFromTransactionId, getSampleTypesFromTransactionIds: allow …
labkey-alan Nov 16, 2023
69b338f
AdminSettingsPage: use useRouteLeave
labkey-alan Nov 16, 2023
714e310
Deprecate withRouteLeave
labkey-alan Nov 16, 2023
22b51c8
SearchPanel: add FIXME comments
labkey-alan Nov 16, 2023
b037077
Build: Attempt to upgrade to react-refresh
labkey-alan Nov 21, 2023
0322449
Alias react-router-dom in watch build, add to externals in package build
labkey-alan Nov 21, 2023
a976b3d
Export useWindowFocusCheckExpiredSession instead of withWindowFocusCh…
labkey-alan Nov 21, 2023
915fccc
Rename useSubNavContext to useSubNavTabsContext
labkey-alan Nov 21, 2023
321905d
Add SubNavContext - This one is needed to set a SubNav component, it …
labkey-alan Nov 21, 2023
fb077a2
SubNavContext: Fix issue with setter, use in NavigationBar
labkey-alan Nov 22, 2023
7a98b46
NavigationBar: Use SubNavWithTabsContext, remove SubNavContext
labkey-alan Nov 22, 2023
a598198
AdministrationSubNav -> useAdministrationSubNav
labkey-alan Nov 22, 2023
8d50481
UsersGridPanel: Fix issue with searchParams null value
labkey-alan Nov 22, 2023
a40ecf8
Export SchemaBrowserRoutes and LineagePage
labkey-alan Nov 27, 2023
c5fe084
useAdministrationSubNav: simplify useEffect return
labkey-alan Nov 27, 2023
de6e711
Add PipelineRoutes
labkey-alan Nov 29, 2023
96b0b20
Convert AccountSubNav to use sub nav context
labkey-alan Nov 29, 2023
6efb874
AssayImportPanels: Don't use location
labkey-alan Nov 29, 2023
dad150a
assayBegin URLMapper: prefix with rd
labkey-alan Nov 29, 2023
a6415c1
AppRouteResolver: Don't return boolean from fetch
labkey-alan Nov 29, 2023
0d8afd9
Remove unused import
labkey-alan Nov 29, 2023
8793713
reducers.ts - add TODO
labkey-alan Nov 29, 2023
1d13896
URLService: remove resolveAppRoute, add resolveRedirect
labkey-alan Nov 29, 2023
7945545
watch.config.js: hot: true
labkey-alan Nov 29, 2023
f89bf25
Bump build version
labkey-alan Nov 29, 2023
c0d7c31
SubNav - render version when in admin route
labkey-alan Nov 29, 2023
2c3daf5
Update components.md
labkey-alan Nov 29, 2023
bb2627b
Remove logout reducer logic, routing table reducers
labkey-alan Nov 30, 2023
9122b82
Don't export SubNav, remove SubNavWithTabsContext
labkey-alan Nov 30, 2023
1f768cf
Don't deprecate BeforeUnload.
labkey-alan Dec 4, 2023
297e770
Update useRouteLeave to use RR6 APIs
labkey-alan Dec 4, 2023
da3927f
CreateProjectPage: Fix navigation after creation
labkey-alan Dec 4, 2023
907bbcb
AppModel: remove default value for logoutReason
labkey-alan Dec 4, 2023
fb36554
SubNav: use <Link> when appropriate
labkey-alan Dec 4, 2023
207b267
ProductMenuSection: Use Link when linking to App pages
labkey-alan Dec 4, 2023
0d3e83a
withRouterDeprecated: memoize DeprecatedLocation
labkey-alan Dec 4, 2023
530080d
URLResolver: PR feedback
labkey-alan Dec 4, 2023
e12523f
PR feedback
labkey-alan Dec 4, 2023
7a61dcc
mockUtils.ts - update createMockWithRouterProps
labkey-alan Dec 4, 2023
49af10b
AssayImportPanels: format
labkey-alan Dec 5, 2023
614d0d1
RouteLeave: add a note about quirks
labkey-alan Dec 5, 2023
5fea136
withQueryModels: fix issue with URL binding
labkey-alan Dec 5, 2023
55dfe42
Remove note about withRouterDeprecated from release notes
labkey-alan Dec 5, 2023
717b6bd
QueryModel: Fix issue with detecting saved settings
labkey-alan Dec 5, 2023
111c97c
QueryModel: Fix issue with searchParams default value
labkey-alan Dec 5, 2023
1c755e2
ProjectManagementPage: define render buttons at top level
labkey-alan Dec 5, 2023
5bb3517
Bump react-router-dom, use useRef in useRouteLeave again (yay)
labkey-alan Dec 6, 2023
0ed3981
SubNav: Fix issues with noun, remove unused attributes from ITab
labkey-alan Dec 6, 2023
f51805d
withQueryModels: Fix issue with bindURL
labkey-alan Dec 6, 2023
24267c0
withQueryModels: use replace with bindURL
labkey-alan Dec 8, 2023
e8b2552
ReportList: fix tests
labkey-alan Dec 11, 2023
4510ddc
fix AppModel tests
labkey-alan Dec 11, 2023
cf1143a
Fix QueryModel locationHasQueryParamSettings tests
labkey-alan Dec 11, 2023
3a5b7c7
Fix AppURLResolver tests
labkey-alan Dec 11, 2023
4aac398
Add react-router-dom mocks for unit tests
labkey-alan Dec 12, 2023
fdf3640
Remove usages of createMockWithRouterProps
labkey-alan Dec 12, 2023
e0e574b
Fix UserManagement tests
labkey-alan Dec 12, 2023
de9231a
Fix withQueryModels tests
labkey-alan Dec 12, 2023
583fe2a
Fix AdminSettingsPage tests
labkey-alan Dec 12, 2023
8fe9a5f
Fix ProductMenu tests
labkey-alan Dec 12, 2023
cc4c28c
Fix ProductMenuSection tests
labkey-alan Dec 12, 2023
91c5550
remove explicit calls to mock react-router-dom
labkey-alan Dec 12, 2023
d2bca6a
Fix CreateProjectPage tests
labkey-alan Dec 12, 2023
499d820
Fix withAssayModels tests
labkey-alan Dec 12, 2023
8978efb
Fix getHeaderMenuSubtitle tests
labkey-alan Dec 12, 2023
88dbe28
Fix tests for useAdministrationSubNav
labkey-alan Dec 12, 2023
f4a329e
Remove unused imports
labkey-alan Dec 12, 2023
8017877
Remove unused imports
labkey-alan Dec 12, 2023
d51d6dc
Add normalizr, @remix-run/router to externals for package build
labkey-alan Dec 13, 2023
01cbbf2
Bump build version
labkey-alan Dec 13, 2023
5219580
Don't export unused search components, export additional search types
labkey-alan Dec 14, 2023
00ab718
ReleaseNote: Use RR6
labkey-alan Dec 15, 2023
85b5079
withAssayModels: update comment
labkey-alan Dec 15, 2023
c813d45
Add unit tests for getQueryParams
labkey-alan Dec 18, 2023
2cdf4bd
Generate Link components for empty sections
labkey-alan Dec 18, 2023
72aa3f8
ProductMenuSection: Fix issue with empty link generation
labkey-alan Dec 18, 2023
7403d65
Remove console.log
labkey-alan Dec 19, 2023
14aa397
UserDetailsPanel: generate correct manage URLs
labkey-alan Dec 19, 2023
e459e7f
UserDetailsPanel: use project from server context
labkey-alan Dec 19, 2023
fa55fa3
Bump build to 7.0.0
labkey-alan Dec 19, 2023
b2842fd
Bump build to 7.0.0
labkey-alan Dec 19, 2023
9c779fb
Deprecate withNotificationsContext
labkey-alan Dec 20, 2023
ab99563
Prep for release
labkey-alan Dec 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
551 changes: 329 additions & 222 deletions packages/build/package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions packages/build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labkey/build",
"version": "6.16.1",
"version": "7.0.0-fb-upgrade-hot-loader.3",
"description": "LabKey client-side build assets",
"files": [
"webpack/"
Expand All @@ -18,6 +18,7 @@
"@babel/preset-env": "~7.22.20",
"@babel/preset-react": "~7.22.15",
"@babel/preset-typescript": "~7.22.15",
"@pmmmwh/react-refresh-webpack-plugin": "~0.5.11",
"ajv": "~8.12.0",
"babel-loader": "~9.1.3",
"bootstrap-sass": "~3.4.3",
Expand All @@ -28,7 +29,7 @@
"fork-ts-checker-webpack-plugin": "~8.0.0",
"html-webpack-plugin": "~5.5.3",
"mini-css-extract-plugin": "~2.7.6",
"react-hot-loader": "~4.13.1",
"react-refresh": "~0.14.0",
"resolve-url-loader": "~5.0.0",
"rimraf": "~5.0.1",
"sass": "~1.67.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/build/webpack/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const BABEL_DEV_CONFIG = {
...BABEL_CONFIG,
options: {
...BABEL_CONFIG.options,
plugins: ['react-hot-loader/babel'].concat(BABEL_PLUGINS),
plugins: [require.resolve('react-refresh/babel')].concat(BABEL_PLUGINS),
}
};

Expand Down
3 changes: 3 additions & 0 deletions packages/build/webpack/package.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ module.exports = {
'@labkey/premium/storage',
'@labkey/premium/search',
'@remirror/pm',
'@remix-run/router',
'@testing-library/jest-dom',
'@testing-library/react',
'@testing-library/user-event',
Expand All @@ -115,6 +116,7 @@ module.exports = {
'lodash',
'moment',
'moment-timezone',
'normalizr',
'numeral',
'prosemirror',
'react',
Expand All @@ -127,6 +129,7 @@ module.exports = {
'react-dom/test-utils',
'react-redux',
'react-router',
'react-router-dom',
'react-select',
'react-select/async',
'react-select/async-creatable',
Expand Down
6 changes: 4 additions & 2 deletions packages/build/webpack/watch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const constants = require('./constants');
const path = require('path');
// relative to the <lk_module>/node_modules/@labkey/build/webpack dir
Expand All @@ -15,7 +16,7 @@ const devServer = {
},
host: 'localhost',
port: constants.watchPort,
hot: 'only',
hot: true,
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
Expand All @@ -37,7 +38,6 @@ for (let i = 0; i < entryPoints.apps.length; i++) {
const entryPoint = entryPoints.apps[i];

entries[entryPoint.name] = [
'react-hot-loader/patch',
entryPoint.path + '/dev.tsx'
];
}
Expand All @@ -57,6 +57,7 @@ module.exports = {
...constants.aliases.LABKEY_PACKAGES_DEV,
// This assures there is only one copy of react used while doing start-link
react: path.resolve('./node_modules/react'),
'react-router-dom': path.resolve('./node_modules/react-router-dom'),
},
extensions: constants.extensions.TYPESCRIPT.concat('.scss')
},
Expand All @@ -68,6 +69,7 @@ module.exports = {
emitOnErrors: false,
},
plugins: [
new ReactRefreshWebpackPlugin(),
// This Plugin type checks our TS code, @babel/preset-typescript does not type check, it only transforms
new ForkTsCheckerWebpackPlugin(constants.TS_CHECKER_DEV_CONFIG)
],
Expand Down
32 changes: 32 additions & 0 deletions packages/components/__mocks__/react-router-dom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const rrd = jest.createMockFromModule('react-router-dom') as any;
export default rrd;

export const Link = rrd.Link;
export const unstable_usePrompt = () => {};

let navigate = jest.fn();

export const __setNavigate = (mockNavigate): void => {
navigate = mockNavigate;
};
export const useNavigate = () => navigate;

// Yes, this doesn't properly match the Location type, however we don't use anything but pathname at the moment
let location_ = { pathname: '' } as Location;

export const __setLocation = (mockLocation: Location): void => {
location_ = mockLocation;
};
export const useLocation = () => location_;

let searchParams = new URLSearchParams();
let setSearchParams = jest.fn();
export const __setSearchParams = (mockSearchParams: URLSearchParams) => searchParams = mockSearchParams;
export const __setSetSearchParams = (mockSetSearchParams) => setSearchParams = mockSetSearchParams;
export const useSearchParams = () => {
return [searchParams, setSearchParams];
};

let params = {};
export const __setParams = (mockParams: Record<string, string>) => params = mockParams;
export const useParams = () => params;
Loading