You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug createCacheEntry() fails if page has data-taxi-view attribute specificed and no custom Renderer.
Not totally sure this is a bug or intended behaviour tbh, I felt as if it was a bug as it was unexpected and took me a minute to actually figure out.
To Reproduce Minimal StackBlitz Example. You can switch from main.js to fixed.jsin home page script to simulate what the behaviour I'd consider normal should be.
Two pages, data-taxi-view="home" & data-taxi-view="about".
createCacheEntry(page){constcontent=page.querySelector('[data-taxi-view]');letRenderer=content.dataset.taxiView.length
? this.renderers[content.dataset.taxiView]
: this.defaultRenderer;/* content.dataset.taxiView.length is actually true (as the view exist as an attribute in html) but this.renderers[content.dataset.taxiView] is undefined (as there's no renderer provided in js) */if(Renderer===undefined)Renderer=this.defaultRenderer;/* fix can be as simple as this, just providing an escape if Renderer is undefined */return{
page,
content,skipCache: content.hasAttribute('data-taxi-nocache'),scripts: this.reloadJsFilter
? Array.from(page.querySelectorAll('script')).filter(this.reloadJsFilter)
: [],title: page.title,renderer: newRenderer({wrapper: this.wrapper,title: page.title,
content,
page,}),};}
Am I missing something? Is it the actual expected behaviour?
Still, thanks for the amazing work in any case and sorry to bother ❤️
The text was updated successfully, but these errors were encountered:
While Taxi could fall back to the default renderer in these situations, I would say that would cause bugs which would be harder to debug: If you had created a HomeRenderer and an AboutRenderer and forgotten to register them, the page would still load but none of your specific renderer code would be executed, leading you down a long path to try and work out why.
I have added a console.warn and updated the npm package 👍
Describe the bug
createCacheEntry()
fails if page hasdata-taxi-view
attribute specificed and no custom Renderer.Not totally sure this is a bug or intended behaviour tbh, I felt as if it was a bug as it was unexpected and took me a minute to actually figure out.
To Reproduce
Minimal StackBlitz Example. You can switch from
main.js
tofixed.js
in home page script to simulate what the behaviour I'd consider normal should be.Two pages,
data-taxi-view="home"
&data-taxi-view="about"
.main.js
renderers
andtransition
can even be avoided but put them there just to make sure that wouldn't somehow fix it.Info
Error in the console
Looking into it Renderer is actually undefined.
Maybe Fix?
Am I missing something? Is it the actual expected behaviour?
Still, thanks for the amazing work in any case and sorry to bother ❤️
The text was updated successfully, but these errors were encountered: