index
References
useSuperglue
Re-exports useSuperglue
useContent
Re-exports useContent
NavigationProvider
Re-exports NavigationProvider
NavigationContext
Re-exports NavigationContext
superglueReducer
Re-exports superglue
pageReducer
Re-exports pages
FetchArgs
Re-exports FetchArgs
GraftingSuccessAction
Re-exports GraftingSuccessAction
GraftingErrorAction
Re-exports GraftingErrorAction
PageKey
Re-exports PageKey
RestoreStrategy
Re-exports RestoreStrategy
NavigationAction
Re-exports NavigationAction
ComponentIdentifier
Re-exports ComponentIdentifier
Keypath
Re-exports Keypath
JSONPrimitive
Re-exports JSONPrimitive
JSONObject
Re-exports JSONObject
JSONMappable
Re-exports JSONMappable
JSONKeyable
Re-exports JSONKeyable
JSONValue
Re-exports JSONValue
ParsedResponse
Re-exports ParsedResponse
Defer
Re-exports Defer
VisitResponse
Re-exports VisitResponse
Page
Re-exports Page
GraftResponse
Re-exports GraftResponse
PageResponse
Re-exports PageResponse
Fragment
Re-exports Fragment
AllPages
Re-exports AllPages
SuperglueState
Re-exports SuperglueState
RootState
Re-exports RootState
Meta
Re-exports Meta
VisitMeta
Re-exports VisitMeta
VisitCreator
Re-exports VisitCreator
RemoteCreator
Re-exports RemoteCreator
Dispatch
Re-exports Dispatch
SuperglueStore
Re-exports SuperglueStore
Handlers
Re-exports Handlers
UJSHandlers
Re-exports UJSHandlers
HistoryState
Re-exports HistoryState
SaveAndProcessPageThunk
Re-exports SaveAndProcessPageThunk
MetaThunk
Re-exports MetaThunk
VisitMetaThunk
Re-exports VisitMetaThunk
DefermentThunk
Re-exports DefermentThunk
BasicRequestInit
Re-exports BasicRequestInit
NavigateTo
Re-exports NavigateTo
NavigationContextProps
Re-exports NavigationContextProps
NavigationProviderProps
Re-exports NavigationProviderProps
BuildStore
Re-exports BuildStore
BuildVisitAndRemote
Re-exports BuildVisitAndRemote
SetupProps
Re-exports SetupProps
ApplicationProps
Re-exports ApplicationProps
Visit
Re-exports Visit
VisitProps
Re-exports VisitProps
Remote
Re-exports Remote
RemoteProps
Re-exports RemoteProps
BeforeSave
Re-exports BeforeSave
ApplicationRemote
Re-exports ApplicationRemote
ApplicationVisit
Re-exports ApplicationVisit
Variables
GRAFTING_ERROR
constGRAFTING_ERROR:"@@superglue/GRAFTING_ERROR"='@@superglue/GRAFTING_ERROR'
Defined in
GRAFTING_SUCCESS
constGRAFTING_SUCCESS:"@@superglue/GRAFTING_SUCCESS"='@@superglue/GRAFTING_SUCCESS'
Defined in
rootReducer
constrootReducer: {superglue:superglueReducer;pages:pageReducer; }
Type declaration
Defined in
Functions
saveAndProcessPage()
saveAndProcessPage(
pageKey:string,page:VisitResponse|GraftResponse):SaveAndProcessPageThunk
Save and process a rendered view from PropsTemplate. This is the primitive function that visit and remote calls when it receives a page.
If you render a page outside the normal request response cycle, e.g, websocket, you can use this function to save the payload.
Parameters
pageKey
string
page
Returns
Defined in
lib/action_creators/index.ts:74
saveResponse()
saveResponse(...
args: [{pageKey:string;page:VisitResponse; }]): {}
Calling this redux#ActionCreator with Args will return an Action with a payload of type P and (depending on the PrepareAction method used) a meta- and error property of types M and E respectively.
Parameters
...args
[{pageKey: string;page: VisitResponse; }]
Returns
{}
Defined in
updateFragments()
updateFragments(
payload: {name:string;path:string;pageKey:string;value:JSONMappable;previousValue:JSONMappable; }): {}
A redux action called whenever a fragment is received from visit or updated using remote. Its a useful action to use for cross cutting concerns like a shared header or a shopping cart. For example:
import { updateFragments } from '@thoughtbot/superglue'
export const exampleSlice = createSlice({
 name: 'Example',
 initialState: {},
 extraReducers: (builder) => {
   builder.addCase(updateFragments, (state, action) => {
     // Update the slice using the latest and greatest.
     return action.valueParameters
payload
object
payload.name
string
payload.path
string
payload.pageKey
string
payload.value
payload.previousValue?
Returns
{}
Defined in
copyPage()
copyPage(
payload: {from:string;to:string; }): {}
A redux action you can dispatch to copy a page from one pageKey to another. Its a very useful way to create optimistic updates with a URL change. For example:
import { copyPage, remote } from '@thoughtbot/superglue'
dispatch(copyPage({ from: originalKey, to: targetKey}))
... make edits to target page and finally
navigateTo(targetKey)Parameters
payload
object
payload.from
string
payload.to
string
Returns
{}
Defined in
removePage()
removePage(
payload: {pageKey:string; }): {}
A redux action you can dispatch to remove a page from your store.
import { removePage } from '@thoughtbot/superglue'
dispatch(removePage({ pageKey: '/delete_me_please"}))Parameters
payload
object
payload.pageKey
string
Returns
{}
Defined in
beforeFetch()
beforeFetch(
payload: {fetchArgs:FetchArgs; }): {}
A redux action called before a fetch takes place. It will fire in remote and visit. You can hook into this event in your redux slices like this:
import { beforeFetch } from '@thoughtbot/superglue'
export const exampleSlice = createSlice({
 name: 'Example',
 initialState: {},
 extraReducers: (builder) => {
   builder.addCase(beforeFetch, (state, action) => {Parameters
payload
object
payload.fetchArgs
Returns
{}
Defined in
beforeVisit()
beforeVisit(
payload: {currentPageKey:string;fetchArgs:FetchArgs; }): {}
A redux action called before a visit takes place. You can hook into this event in your redux slices like this:
import { beforeVisit } from '@thoughtbot/superglue'
export const exampleSlice = createSlice({
 name: 'Example',
 initialState: {},
 extraReducers: (builder) => {
   builder.addCase(beforeVisit, (state, action) => {Parameters
Returns
{}
Defined in
beforeRemote()
beforeRemote(
payload: {currentPageKey:string;fetchArgs:FetchArgs; }): {}
A redux action called before remote takes place. You can hook into this event in your redux slices like this:
import { beforeRemote } from '@thoughtbot/superglue'
export const exampleSlice = createSlice({
 name: 'Example',
 initialState: {},
 extraReducers: (builder) => {
   builder.addCase(beforeRemote, (state, action) => {Parameters
Returns
{}
Defined in
prepareStore()
prepareStore(
store:SuperglueStore,initialPage:VisitResponse,path:string):void
Parameters
Returns
void
Defined in
setup()
setup(
__namedParameters:SetupProps): {visit:ApplicationVisit;remote:ApplicationRemote;nextHistory:History;initialPageKey:string;ujs:handlers; }
This is the setup function that the Application calls. Use this function if you like to build your own Application component.
Parameters
__namedParameters
Returns
{visit: ApplicationVisit;remote: ApplicationRemote;nextHistory: History;initialPageKey: string;ujs: handlers; }
Defined in
Application()
Application(
__namedParameters:ApplicationProps):Element
The entry point to your superglue application. It sets up the redux Provider, redux state and the Navigation component.
This is a simple component, you can override this by copying the source code and use the exported methods used by this component (start and ujsHandler).
Parameters
__namedParameters
Returns
Element
Defined in
getIn()
getIn(
node:JSONMappable,path:string):JSONValue
Retrieves data from a JSON object using a Keypath
Parameters
path
string
Returns
Defined in
urlToPageKey()
urlToPageKey(
url:string):PageKey
Converts a url to a PageKey.
Parameters
url
string
Returns
Defined in
Last updated
Was this helpful?