I have a Yesod widget that loads the widget twice. The "main" widget looks like this:
<div .container-fluid .hidden-xs>
<div .row .no-gutter>
<div .col-sm-3>
<div .col-sm-9>
^{dashboardMain}
<nav .visible-xs>
<div .container .visible-xs>
<div .row .no-gutter>
^{dashboardMain}
I'm having problems because the Julius file for my argument is dashboardMaindownloaded and compiled twice. Yesod merges two copies of my Julius file. This upsets the situation elsewhere.
My Haskell code looks like this:
crmSidebar :: Widget
crmSidebar = defaultSidebarItems -- Using Knockout and a convention based "api"
crmApp :: Widget
crmApp = $(widgetFile "app/crm")
getCRMDashboardR :: Handler TypedContent
getCRMDashboardR = selectRep . provideRep . defaultLayout $ dashboardLayout crmSidebarItems crmApp
Haskell compiles fine, but as I said, I get a Javascript error at runtime due to the way Yesod / Julius handles my widget. What should I do?
Edit 1:
I use KnockoutJS, which requires it to be ko.applyBindings(viewModel)applied exactly once. Changing this setting is not an option.
dashboardLayout determined by
dashboardLayout :: String -> Widget -> Widget -> Widget
dashboardLayout sidebarHeader dashboardSidebarItems dashboardMain = $(widgetFile "layouts/dashboard")
nomen source
share