Skip to content

Instantly share code, notes, and snippets.

@thomaswelton
thomaswelton / RouterContext.js
Created September 12, 2023 15:07
RouterContext component. Takes the StaticHandlerContext from React Router and adds support for handling promises which come from deferred data loaders.
// @flow
/* eslint-disable react/no-danger */
import React, { Suspense, useMemo } from 'react';
import { Await, useAsyncError, useAsyncValue } from 'react-router-dom';
import type { StaticHandlerContext } from '@remix-run/router/router';
type KeyProps = {
itemKey: string,
itemSubkey: string
};
<?php
//redirect for the website
$isFB = strripos($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit');
if($isFB === false && is_null(JRequest::getVar('signed_request',NULL)) && is_null(JRequest::getVar('nr',NULL)) && is_null(JRequest::getVar('task',NULL)) && JRequest::getVar('view') != 'entrylist' ) {
//Facebook needs to see this page on our domain to get the og tags, but users should be redirected to the tab version
$redirectUrl = 'http://apps.facebook.com/'.$facebook->getAppId().'/?app_data='.json_encode($app_data);
$mainframe->redirect($redirectUrl);
}