Skip to content

Commit

Permalink
Use inject fallback to suppress warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hvangeffen committed Jan 30, 2025
1 parent fd8900b commit f511ca2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/services/useDateRegistry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function createDateRegistry() {
* @param dates The reactive ref containing `Date[]` to be registered.
*/
export function useDateRegistry(dates: DateRefOrGetter) {
const registry = inject(DATE_REGISTRY_KEY)
const registry = inject(DATE_REGISTRY_KEY, undefined)
if (!registry) return

onMounted(() => {
Expand Down
6 changes: 2 additions & 4 deletions src/services/useSelectedDate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ export function provideSelectedDate(date: DateRefOrGetter) {
* @returns The selected date.
*/
export function useSelectedDate(fallbackDate: DateRefOrGetter) {
const injectedDate = inject(SELECTED_DATE_KEY)
const injectedDate = inject(SELECTED_DATE_KEY, fallbackDate)

const selectedDate = injectedDate
? computed(() => toValue(injectedDate))
: computed(() => toValue(fallbackDate))
const selectedDate = computed(() => toValue(injectedDate))

return {
selectedDate,
Expand Down

0 comments on commit f511ca2

Please sign in to comment.