From 94440b235d2332db8ec0171df3a05400a24372ea Mon Sep 17 00:00:00 2001 From: Vermont Phil Paguiligan <88662506+dexv2@users.noreply.github.com> Date: Tue, 21 May 2024 00:54:32 +0800 Subject: [PATCH 1/2] Warning: Agenda: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. Resolve deprecation warning when using Agenda view. Warning: Agenda: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. at Agenda (webpack-internal:///(app-pages-browser)/./node_modules/react-big-calendar/dist/react-big-calendar.esm.js:4299:24) at div at Calendar (webpack-internal:///(app-pages-browser)/./node_modules/react-big-calendar/dist/react-big-calendar.esm.js:4609:90) at UncontrolledComponent (webpack-internal:///(app-pages-browser)/./node_modules/uncontrollable/lib/esm/uncontrollable.js:45:37) at div at VolunteerProfile (webpack-internal:///(app-pages-browser)/./components/VolunteerProfile.tsx:18:11) at div at Page (Server) at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:243:11) at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:74:9) at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:82:11) at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11) at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:348:11) at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:160:11) at InnerScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:153:9) at ScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:228:11) at RenderFromTemplateContext (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44) at OuterLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:369:11) at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:243:11) at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:74:9) at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:82:11) at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11) at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:348:11) at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:160:11) at InnerScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:153:9) at ScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:228:11) at RenderFromTemplateContext (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44) at OuterLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:369:11) at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:243:11) at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:74:9) at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:82:11) at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11) at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:348:11) at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:160:11) at InnerScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:153:9) at ScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:228:11) at RenderFromTemplateContext (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44) at OuterLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:369:11) at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:243:11) at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:74:9) at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:82:11) at NotFoundErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:76:9) at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11) at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:348:11) at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:160:11) at InnerScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:153:9) at ScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:228:11) at RenderFromTemplateContext (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/render-from-template-context.js:16:44) at OuterLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/layout-router.js:369:11) at div at div at body at html at RootLayout (Server) at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:74:9) at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/redirect-boundary.js:82:11) at NotFoundErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:76:9) at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/not-found-boundary.js:84:11) at DevRootNotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/dev-root-not-found-boundary.js:33:11) at ReactDevOverlay (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/react-dev-overlay/app/ReactDevOverlay.js:87:9) at HotReload (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/react-dev-overlay/app/hot-reloader-client.js:321:11) at Router (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/app-router.js:207:11) at ErrorBoundaryHandler (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:113:9) at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/error-boundary.js:160:11) at AppRouter (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/app-router.js:577:13) at ServerRoot (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/app-index.js:112:27) at Root (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/app-index.js:117:11) --- src/Agenda.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Agenda.js b/src/Agenda.js index a076bcfff..3e6716c3b 100644 --- a/src/Agenda.js +++ b/src/Agenda.js @@ -15,7 +15,7 @@ function Agenda({ date, events, getters, - length, + length = 30, localizer, onDoubleClickEvent, onSelectEvent, @@ -217,10 +217,6 @@ Agenda.propTypes = { selected: PropTypes.object, } -Agenda.defaultProps = { - length: 30, -} - Agenda.range = (start, { length = Agenda.defaultProps.length, localizer }) => { let end = localizer.add(start, length, 'day') return { start, end } From b8a13aa4d619c2b17bd6c9d00bab0e1f0c0d6748 Mon Sep 17 00:00:00 2001 From: Vermont Phil Paguiligan <88662506+dexv2@users.noreply.github.com> Date: Wed, 5 Jun 2024 19:10:43 +0800 Subject: [PATCH 2/2] Update Agenda.js - Created const DEFAULT_LENGTH = 30; at the top of the template - Replaced all Agenda.defaultProps.length by DEFAULT_LENGTH --- src/Agenda.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Agenda.js b/src/Agenda.js index 3e6716c3b..820b9a315 100644 --- a/src/Agenda.js +++ b/src/Agenda.js @@ -9,13 +9,15 @@ import { navigate } from './utils/constants' import { inRange } from './utils/eventLevels' import { isSelected } from './utils/selection' +const DEFAULT_LENGTH = 30; + function Agenda({ accessors, components, date, events, getters, - length = 30, + length = DEFAULT_LENGTH, localizer, onDoubleClickEvent, onSelectEvent, @@ -217,7 +219,7 @@ Agenda.propTypes = { selected: PropTypes.object, } -Agenda.range = (start, { length = Agenda.defaultProps.length, localizer }) => { +Agenda.range = (start, { length = DEFAULT_LENGTH, localizer }) => { let end = localizer.add(start, length, 'day') return { start, end } } @@ -225,7 +227,7 @@ Agenda.range = (start, { length = Agenda.defaultProps.length, localizer }) => { Agenda.navigate = ( date, action, - { length = Agenda.defaultProps.length, localizer } + { length = DEFAULT_LENGTH, localizer } ) => { switch (action) { case navigate.PREVIOUS: @@ -239,7 +241,7 @@ Agenda.navigate = ( } } -Agenda.title = (start, { length = Agenda.defaultProps.length, localizer }) => { +Agenda.title = (start, { length = DEFAULT_LENGTH, localizer }) => { let end = localizer.add(start, length, 'day') return localizer.format({ start, end }, 'agendaHeaderFormat') }