vercel / next.js

The React Framework
https://nextjs.org
MIT License
126k stars 26.87k forks source link

Smart banner ios work is incorrect #41049

Open thanhchuongbmd opened 2 years ago

thanhchuongbmd commented 2 years ago

Verify canary release

Provide environment information

Operating System:
Platform: win32
Arch: x64 Version: Windows 10 Pro Binaries: Node: 14.17.3 npm: N/A Yarn: N/A pnpm: N/A Relevant packages:
next: 12.2.5 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0

What browser are you using? (if relevant)

Safari

How are you deploying your application? (if relevant)

No response

Describe the Bug

Route: https://domain.com/shop/1 I insert tag into to show smart banner ios on safari <meta key={"smart-banner"} name="apple-itunes-app" content={app-id=AppID} content={app-id=${process.env.NEXT_PUBLIC_APPSTORE_ID}
app-argument={appScheme://shop?id=1 } }

After that, I navigate to shop with id 2, the tag meta is change to 2, but when tap "Open" then app open shop with id 1, it retain old id

Expected Behavior

At shop id 2, app navigate to shop id 2. Like youtube when open on safari, watch a video, tap "Open" then app navigate to correct video

Link to reproduction

https://berivina.com/location/con-duong-gom-tokoname-809

To Reproduce

MetaBenji commented 11 months ago

@thanhchuongbmd did you ever find a solution for this problem?

I'm having the same issue. app-argument is always set to the initial URL provided in the first HTML painted by Safari, which in my case is generated server side. I've tried updating it in a useEffect and after navigation, but its always using the initial URL provided to app-agrument.

It also doesn't display the app banner if I include the meta tag in a component that is dynamically important with server side rendering set to false. That's how I've been able to deduce that Safari seems to only be checking the initial HTML painted by Safari and doesn't re-check after navigation as well.