Earlier this year, when it was announced that Bob Odenkirk was going to guest on The Bear, we all said something to the effect of, “Oh, wow, that’s nice. He’s super Chicago-y; he’ll fit right in on that show. I wonder who he’ll play? Maybe a sketchy uncle of some sort? A business associate?” Little did we know that Odenkirk was just one of the guests recruited for the most jaw-dropping episode of The Bear’s second season so far.
“Fishes,” which takes place approximately five years before season two, blasts us with rapid-fire cameos about 30 seconds into the episode, so let’s run this down. First there’s Jon Bernthal, back as the late Mikey Berzatto, as well as Odenkirk, who plays the Berzattos’ “Uncle” Lee Lane,though the different surname and “Polski, baby” heritage suggest he’s about as related to them as Uncle Jimmy is. You’ve also got Ricky Staffieri — an actor and filmmaker who was working on The Bear’s crew — stepping into the role of Theodore Fak. Gillian Jacobs plays Tiffany, Richie’s now-ex-wife, and Chicago’s own John Mulaney plays Stevie, the romantic partner of Sarah Paulson’s Cousin Michelle, who lives in New York, is very cool, and might be related to Lee but it’s unclear. Oh, and did I mention that Oscar winner Jamie Lee Curtis is there? She’s playing the rapidly deteriorating Donna Berzatto, who’s absolutely hell-bent on making the holiday beautiful for her family but also teetering on the precipice of mental collapse. That’s a lot of fucking guest stars for any series, let alone one episode, but luckily for The Bear they all manage to scream in harmony for “Fishes,” an episode that builds to a rolling boil about five minutes in and doesn’t let up for the rest of its hour-long run time.
It all kicks off with a very beleaguered and brown-haired Natalie smoking with Mikey out front. He’s trying to remind her not to ask their mom if she’s okay, because she hates that, but Sugar argues that it’s actually perfectly fine to ask if someone’s okay if you actually care if they’re okay. He’s saying it’s better if she just doesn’t care — not just for her own sanity but for that of everyone at the Christmas dinner, which seems like one of those events that should absolutely not happen and everyone totally hates but also feels like they’re obligated to attend even if it’s the worst part of their year. Carmy is home from Denmark, which is a lovely gesture, but everyone at the party is making him feel like total shit for leaving in the first place. Our Mother of Victory, pray for us.
As Darlene Love’s “All Alone on Christmas” plays — the best cut on the Home Alone 2: Lost in New York soundtrack, for what it’s worth — our cavalcade of guests runs through the frame. We get a scene of the Fak brothers introducing their baseball-card scheme to Uncle Jimmy, which sets up the manic pace and level of intensity we’re going to be at throughout this entire episode. Cicero calls the $500 plot “the stupidest fuckin’ idea I ever heard,” issuing both of the brothers a slap that they become convinced was “a business slap.”
Here’s where I’ll come right out and say that I recognize a bit of myself and the women in my family in Donna Berzatto. I don’t have the bedroom leopard or the presumably undiagnosed mental illness (fully diagnosed, thanks!), but there’s this kind of martyrdom that I think women, especially, can pass down from generation to generation when it comes to families and holidays. Everything has to be perfect or everything is ruined. We live for tradition without questioning why it’s a tradition in the first place. And we break our backs while fully knowing we won’t get the thanks we deserve — or even if we do, that we won’t be able to receive those thanks in a way that actually leaves us feeling satisfied or complete. It’s a fucking curse and it ruins holidays, and while Donna’s clearly got a lot going on besides her constantly tolling timers and immensely complicated meal plan, trying to execute the Feast of the Seven Fishes for a house full of screaming assholes certainly isn’t making her life any easier. Of course, she’s not taking or asking for the help she needs, either, but … who does? She’d rather just butter up some garlic bread with her hands and try to find “briochie” (with a long e) for Tiffany.
Donna clearly loves her kids, but sometimes it’s hard to know if they love her back — or if they even love each other. It’s more like they’re all tethered to this family by obligation and circumstance, like survivors on some listless life raft. Carmy seems to be annoyed he came back from Europe, which he says is the most beautiful place he’s ever been, but when he expresses that regret to Mikey, who’s already been throwing pot shots at him about the entirety of his life being cooking, all he gets in return is a chorus of “FUCK YOU. WHOA! WHY THE FUCK WOULD YOU SAY THAT?,” as well as an admonition from his mom to “say the words,” i.e., say “I love you” to his brother. Mikey takes the love but then throws back a dig, saying Carmy is “too fancy” for his family, which is one of those shitty things families say to each other that make the recipient feel like everything they’ve ever been told or encouraged to do has been a lie. Supercool stuff, right?
We also learn that Carmy has held a flame for Claire for some time, as both Mikey and Richie corner him at the party to let him know that they ran into her and “she’s beautiful.” They call her “the love of your fucking life” and “that genius down the street,” telling a taken-aback Carmy that “the glasses came off” and “she’s like librarian in a fuckin’ porno.” As Carmy gets more and more angry that they even approached her with him in mind, Mikey and Richie call in Mulaney’s Stevie, who tells Carmy that Claire is, in fact, “a deeply good person” who “teaches CPR to differently abled college students” on the weekends. This is good to know, because there was a part of me that was worried she was going to break young Carmy’s heart, but it also makes me wonder why he pretended to not know who she was at the grocery store when he first saw her. Probably the same reason he gave her a fake number.
Speaking of heartbreak: Richie and Tiffany are genuinely very sweet together. He’s clearly nervous about taking on all the responsibility and financial pressure that comes with having a baby, but he’s also motivated enough by the whole thing that he seeks out Cicero to ask him for help and a little job training. He wants to stop working with Mikey at the Beef, which is notable considering he seems to have been working there with Mikey right up until the end. You’ve got to imagine that Richie fucked up both the Jimmy job and his marriage, which is heartbreaking, but also really makes you curious about the circumstances. Did Mikey lay on the guilt? Did Richie see that Mikey was cracking up in a way that made him feel too guilty or protective to leave?
The Fak brothers try to teach Stevie a dice game in an interlude that I really like because (a) the dice game is absurd and (b) they lean on him about their baseball-card plan and he agrees to give them $500 for their “ROI on RBIs” because “whatever you do with that [money] is going to be very interesting to me,” which seems about right. “All I ask,” Stevie says, “is that one of you has to get in touch with me weekly to talk about the inventory, what’s in the boxes, what’s not in them …” This is exactly what I like to think I would do in this situation, because getting to see weird shit unfold is undoubtedly the best thing about going to your spouse’s family party at Christmas.
We also get a little peek into Carmy’s life in Denmark, which seems to mirror Marcus’s almost exactly, right down to the boat and invisible cat. After Carmy’s plea to work with Mikey at the Beef is denied, he presents his brother with a pencil sketch of the Bear that he did, which makes Mikey tear up. We saw the drawing in season one, and when Carmy tells Mikey, “We could do this, you know?,” Mikey says, “Yeah. Let it rip,” a direct reference to the note and envelope that was discovered at the end of last season. When Carmy walks away, though, Mikey looks immediately overwhelmed and deeply sad, collapsing into sobs and punching himself in the face.
It’s that kind of behavior, coupled with what Mikey does later in the episode with the forks, plus Donna’s total meltdown, that makes me wonder about the mental illness simmering in this family’s genetics. I’m not a doctor or a therapist, but I do struggle with depression and anxiety, among other issues, and going off my meds has definitely led to this sort of sobbing and spiraling, especially around the holidays. Cousin Michelle seems to recognize how fraught the whole dynamic is when she offers Carmy a place to stay if he wants to get out of town after Christmas. She’s got a spot in New York for him, and she’ll take him to some nice restaurants. “I see what happens here, and I can see how it gets in your head,” she tells him. “I don’t want that for you.”
Certainly no one wants what happens at dinner, an utterly destructive blowout involving Mikey, Lee, and Donna. Mikey and Lee are at each other because Lee is a fucking asshole who can’t just let Mikey retell a story everyone’s heard, and Mikey’s a loose cannon who’s prone to throwing forks at his 60-something maybe-uncle. Shit escalates fast, with Lee telling Mikey to stop throwing forks and Mikey retorting, “I can throw forks because this is our father’s house, my father’s house.” Lee amps shit up even more by spitting back something about how Mikey is actually a grown man living in said house with his mom, “borrowing money off her and any other sucker that won’t tell you to go scratch.”
“This guy’s nothing and he’s nobody,” Lee continues. “You’re scared and afraid, aren’t you, Michael? I don’t know what you’re on and if you can hear me through the fog, but if you throw another fork at me, you’re going to get fuckin’ rocked.” It’s the kind of threat that could feel silly and thin, considering Mikey could probably take Lee in a fight, but also you’ve got to think that Lee has seen some shit, so who knows? It’s Christmas and both of these bulls are holding everyone else hostage with their uncomfortable pride and machismo, and it’s awful.
When Donna finally enters the dining room, it looks like things are going to die down a bit after a round of applause and a beautiful grace from Stevie, who says that executing the Feast of the Seven Fishes is a way that we can show love to our families and to each other. There are lovely little bits about how sensitive bears are and about how we learn to let other people into our celebrations, but when Donna breaks down in tears a bit at the end, and Natalie reflexively asks, “Are you okay,” shit goes south fast. “Natalie Rose Berzatto,” Donna says, “do I not look okay?” Michelle pipes in with a tiny “not really” in Natalie’s defense, and then Donna starts berating everyone and breaking plates, ultimately fleeing.
That leaves the room to almost breathe a sigh of relief until Lee says “Well, we all knew that was going to happen” and noting that it was “the worst I’ve ever seen her.” Mikey, understandably, takes this personally, pitches the fork, and then fists start flying. Family members are holding each other back and then—bam!—Donna drives her car through the wall and into the living room. The episode ends with Carmy staring at the thrown fork lodged in the cannolis, Natalie staring off into the distance with big circles under her eyes, and Mikey beating on the door of the car, repeating, “Ma, What did you do? Open the door, Ma.”
Much in the vein of season one’s “Review,” “Fishes” is absolutely exhausting to watch. You leave it feeling drained emotionally and spiritually, not unlike the feeling so many of us get after our own combative family-holiday hangs. The Bear is exceptionally good at crafting that feeling of intense pressure and futility in a way that’s both compelling and deeply uncomfortable. Both the writing and the execution of “Fishes” speaks to how well The Bear is able to walk its dramatic tightrope, and come Emmy season 2024, you just know everyone involved in this episode is going to clean the hell up. The only question is whether Bernthal or Odenkirk will take home the guest actor award. Lord knows they both really deserve it.
• “What are you, a fuckin’ pop machine?” I’d like Carmy’s homemade Sprite recipe now, please.
• Great use of jagoff in this episode. It’s a word that has Pittsburgh origins but is widely used in Chicago, and I’ve always felt like it’s the most perfect put-down.
• I like to imagine Uncle Lee existing in the same universe as Bill Swerski’s Super Fans, which Odenkirk co-created with Robert Smigel.
• “Big Neil” bought little Neil and Ted skateboards using Kohl’s Cash. Many blessings to whichever writer brought that detail to the script, because I adore it.
• Sugar got her nickname because she once added a cup of sugar to gravy instead of a cup of salt — which would also be too much salt, I think. Donna says the mistake made the gravy so sweet it “tasted like Hawaiian Punch.”
• Pete’s chatter about how there are “good lights in the neighborhood this year” is so perfectly family Christmas and midwestern.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(4),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(135),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"4":4,"12":12,"124":124,"135":135}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(406),Fingerprint2=require(408),DS=require(407),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(406),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"406":406,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]