Skip to content

Commit

Permalink
Merge pull request #553 from dappforce/improvement/ui
Browse files Browse the repository at this point in the history
Fix Grill Widget SetConfig 404 issue
  • Loading branch information
olehmell authored Feb 23, 2024
2 parents 655e2f0 + 69359e9 commit 56b8573
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/content-staking/SuperLike.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default function SuperLike({
return (
<div
{...props}
className={cx('flex items-center gap-3', props.className)}
className={cx('flex items-center gap-3 text-sm', props.className)}
>
{disabledCause ? (
<PopOver
Expand Down
16 changes: 11 additions & 5 deletions src/providers/config/ConfigProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { env } from '@/env.mjs'
import { getCurrentUrlOrigin } from '@/utils/links'
import { sendMessageToParentWindow } from '@/utils/window'
import { useRouter } from 'next/router'
import { createContext, useContext, useEffect, useRef, useState } from 'react'
import urlJoin from 'url-join'
import { ConfigContextState, getConfig } from './utils'

const ConfigContext = createContext<ConfigContextState>({
Expand Down Expand Up @@ -29,16 +31,20 @@ export function ConfigProvider({ children }: { children: any }) {
if (eventData && eventData.type === 'grill:setConfig') {
const payload = eventData.payload as string
const currentPathnameAndQuery = window.location.href.replace(
getCurrentUrlOrigin(),
urlJoin(getCurrentUrlOrigin(), env.NEXT_PUBLIC_BASE_PATH),
''
)
const payloadPathname = payload.replace(
new RegExp(`^${env.NEXT_PUBLIC_BASE_PATH}`),
''
)
if (
payload &&
!payload.startsWith('http') &&
payload !== currentPathnameAndQuery
payloadPathname &&
!payloadPathname.startsWith('http') &&
payloadPathname !== currentPathnameAndQuery
) {
sendMessageToParentWindow('isUpdatingConfig', 'true')
await push(payload)
await push(payloadPathname)
sendMessageToParentWindow('isUpdatingConfig', 'false')
}
}
Expand Down

0 comments on commit 56b8573

Please sign in to comment.