Browse Source

fix: reduce webapp icon displayed on browser tab flickering when page is loading (#9212)

tags/0.9.2
Hash Brown 1 year ago
parent
commit
1c1e008dcf
No account linked to committer's email address
2 changed files with 6 additions and 1 deletions
  1. 5
    0
      web/app/(shareLayout)/layout.tsx
  2. 1
    1
      web/hooks/use-app-favicon.ts

+ 5
- 0
web/app/(shareLayout)/layout.tsx View File

import React from 'react' import React from 'react'
import type { FC } from 'react' import type { FC } from 'react'
import type { Metadata } from 'next'
import GA, { GaType } from '@/app/components/base/ga' import GA, { GaType } from '@/app/components/base/ga'


export const metadata: Metadata = {
icons: 'data:,', // prevent browser from using default favicon
}

const Layout: FC<{ const Layout: FC<{
children: React.ReactNode children: React.ReactNode
}> = ({ children }) => { }> = ({ children }) => {

+ 1
- 1
web/hooks/use-app-favicon.ts View File

} = options } = options


useAsyncEffect(async () => { useAsyncEffect(async () => {
if (!enable)
if (!enable || (icon_type === 'image' && !icon_url) || (icon_type === 'emoji' && !icon))
return return


const isValidImageIcon = icon_type === 'image' && icon_url const isValidImageIcon = icon_type === 'image' && icon_url

Loading…
Cancel
Save