Skip to content

Commit

Permalink
initialEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Jun 13, 2020
1 parent bbc78ee commit 380e104
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages-premium
1 change: 1 addition & 0 deletions packages/common/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export const CALENDAR_OPTION_REFINERS = { // does not include base nor calendar
buttonText: identity as Identity<ButtonTextCompoundInput>,
views: identity as Identity<{ [viewId: string]: ViewOptions }>,
plugins: identity as Identity<PluginDef[]>,
initialEvents: identity as Identity<EventSourceInput>,
events: identity as Identity<EventSourceInput>,
eventSources: identity as Identity<EventSourceInput[]>
}
Expand Down
14 changes: 9 additions & 5 deletions packages/common/src/reducers/eventSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DateProfile } from '../DateProfileGenerator'
import { Action } from './Action'
import { guid } from '../util/misc'
import { CalendarContext } from '../CalendarContext'
import { CalendarOptions } from '../options'


export function initEventSources(calendarOptions, dateProfile: DateProfile, context: CalendarContext) {
Expand Down Expand Up @@ -247,14 +248,17 @@ function excludeStaticSources(eventSources: EventSourceHash, context: CalendarCo
}


function parseInitialSources(rawOptions, context: CalendarContext) {
function parseInitialSources(rawOptions: CalendarOptions, context: CalendarContext) {
let refiners = buildEventSourceRefiners(context)
let rawSources = rawOptions.eventSources || []
let singleRawSource = rawOptions.events
let rawSources = [].concat(rawOptions.eventSources || [])
let sources = [] // parsed

if (singleRawSource) {
rawSources.unshift(singleRawSource)
if (rawOptions.initialEvents) {
rawSources.unshift(rawOptions.initialEvents)
}

if (rawOptions.events) {
rawSources.unshift(rawOptions.events)
}

for (let rawSource of rawSources) {
Expand Down

0 comments on commit 380e104

Please sign in to comment.