-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Page]✨ add forceRender
to force render of the title, actions & breadcrumbs to be in page vs in the top bar.
#695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
forceRenderTitle
&& forceRenderActions
to control if the re…forceRenderTitle
&& forceRenderActions
to control if the re…
ba03408
to
89c3895
Compare
I am using latest Polaris 3.1.1 and my Page component is not respecting this idea of forceRenderingActions seriously.. my setup is..
And yet my primaryAction button is rendering in that ugly separate top heading bar... what? I am now super confused. I am using AppProvider with an API key, so this is App Bridge enabled. Whatever that means. I am so disappointed at the level of confusion introduced by all these breaking changes it is disheartening to say the least. |
@resistorsoftware the idea of This is unfortunately not part of Polaris 3.1.1 yet so the only way to see There are a few work around mentioned in #669 to have this working today. (I personally like #669 (comment) the most) I hope this help! |
Thanks @michelleyschen Personally, I hate wasting my time, and using workarounds is just that. I am not into re-visiting work a few months or longer down the road to simply remove workarounds that fix what should be fixed for real, now. I am seeing countless complaints and errors and bugs with App Bridge et al... including what happened last night. The button I see (rendered in the "wrong" place belongs to a completely different App running in a different tab, in the same shop! I am uncomfortable being a guinea pig as the Shopify team attempts to bring the App Bridge to life, and also, I am not pleased the documentation and directions do not follow when implementing Polaris. It should be WYSIWYG but instead, as this shows, it is more like chaos. |
src/components/Page/Page.tsx
Outdated
(breadcrumbs != null && breadcrumbs.length > 0) | ||
); | ||
const hasHeaderTitle = | ||
title != null && title !== '' && (appBridge ? forceRenderTitle : true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick note: whenever you're comparing the string ''
, always consider if you need to trim()
the string first to avoid bugs using extra spaces at the end. I think this check will pass if title is " "
, which doesn't look like the desired behaviour? Could be wrong, though! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is the existing logic in Polaris, I am un-sure about changing the check @tmlayton double checking if this is the desired behaviour or can I introduce the trim check?
Do we have to wait till 2019 for Polaris to work with an Embedded App and Page component? Why is it taking so long to fix and make it consistent with the dreams and documentation? |
@michelleyschen I’d prefer to keep this approach a bit simpler where Personally, I’m leaning heavily towards removing app bridge from Polaris entirely. It seems to have caused more issues and confusion than it has been helpful. I’m thinking we would still provide a set of React components which wrap app bridge (maybe even keep the same names), as well as an @resistorsoftware the criticisms are appreciated. Given I did most of the work integrating App Bridge with Polaris, it’s disappointing it hasn’t gone smoothly. It’s a fair point about being forced into early adoption (guinea pig) with App Bridge. While App Bridge is ultimately the path forward at Shopify, we were too optimistic including it in v3.0.0 as App Bridge was being launched. That being said, this is a pull request. Please keep comments specific to @michelleyschen’s approach to force-rendering |
src/components/Page/Page.tsx
Outdated
/** Decreases the maximum layout width. Intended for single-column layouts */ | ||
singleColumn?: boolean; | ||
/** Force render of title and breadcrumbs in page on embedded app, default false */ | ||
forceRenderTitle?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking only a forceRender
prop which simply skips app bridge delegation.
@michelleyschen -- I chatted with @nwtn about this and I'm very supportive of this from a Merchant Experience of Apps perspective. I have two clarifying questions though:
Thank you! |
@resistorsoftware can you clarify who is complaining? Is is the merchant or app developers?
Can you please log an issue in this repo so we can dig into it?
I created a new issue so we can discuss removing App Bridge from Polaris #814 |
The
Any app or |
55129f5
to
91da6f3
Compare
forceRenderTitle
&& forceRenderActions
to control if the re…forceRender
&& forceRenderActions
to control if the re…
forceRender
&& forceRenderActions
to control if the re…forceRender
to force render of the title, actions & breadcrumbs to be in page vs in the top bar.
@tmlayton update the code to just have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment about the doc link and looks like a bad rebase of the changelog, otherwise this looks fine.
5a3ad42
to
3d70a01
Compare
Changelog is still including entries that have since been released |
ee2e47a
to
0e9a9fa
Compare
Don't know how I missed that twice, sorry @tmlayton. Should be good now. |
0e9a9fa
to
83c489d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't approve this since I am the original author lol
* Force render in page and do not delegate to the app bridge TitleBar action | ||
* @default false | ||
* @embeddedAppOnly | ||
* @see {@link https://polaris.shopify.com/components/structure/page#section-use-in-an-embedded-application|Shopify Page Component docs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we...updating the doc in this link?
7bdb805
to
b22ee3e
Compare
b22ee3e
to
bde9e30
Compare
…bs to be in page vs in the top bar.
b879ffe
to
9566549
Compare
🎉 Thanks for your contribution to Polaris React! |
forceRender
to force render of the title, actions & breadcrumbs to be in page vs in the top bar.forceRender
to force render of the title, actions & breadcrumbs to be in page vs in the top bar.
WHY are these changes introduced?
Resolves #669 (comment)
WHAT is this pull request doing?
Added
forceRender
to title, breadcrumbs, and actions render in the app when app-bridge is useDefault using app bridge

ie.
<AppProvider apiKey={YOUR_API_KEY}>
Default without app bridge

ie.
<AppProvider apiKey={undefined}>
Using app bridge & forceRenderTitle

ie.
<AppProvider apiKey={YOUR_API_KEY}><Page title="test title" forceRenderTitle /></AppProvider>
Using app bridge & forceRenderActions

ie.
<AppProvider apiKey={YOUR_API_KEY}><Page title="" primaryAction={{content: 'Save'}} forceRenderActions /></AppProvider>
Using app bridge, forceRenderTitle, and forceRenderActions

ie.
<AppProvider apiKey={YOUR_API_KEY}><Page title="test title" primaryAction={{content: 'Save'}} forceRenderTitle forceRenderActions /></AppProvider>
Using app bridge, forceRender

ie.
<AppProvider apiKey={YOUR_API_KEY}><Page title="test title" primaryAction={{content: 'Save'}} forceRender /></AppProvider>
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist