Breezy
main
main
  • README
  • Code of conduct
  • Contributing Guide
  • Changelog
  • Security Policy
  • docs
    • configuration
    • Cross cutting concerns
    • deferments
    • Demo Application
    • Digging
    • Overview
    • Installation
    • NavigationContext
    • The page response
    • Rails utils
    • The store shape
    • Requests
    • Tutorial
    • The return of Rails UJS
    • recipes
      • Infinite scroll
      • Modals
      • progress-bar
      • Shopping cart
      • SPA (Single Page Application) Pagination
      • Server-Side Rendering
      • Replicating Turbo behavior
      • Usage with vite
    • Modules
      • Functions
      • Functions
      • index
      • types.actions
      • types
      • Interfaces
Powered by GitBook
On this page
  • References
  • Variables
  • Functions

Was this helpful?

  1. docs
  2. Modules

index

PreviousFunctionsNexttypes.actions

Last updated 4 months ago

Was this helpful?

References

useSuperglue

Re-exports

useContent

Re-exports

NavigationProvider

Re-exports

NavigationContext

Re-exports

superglueReducer

Re-exports superglue

pageReducer

Re-exports pages

FetchArgs

GraftingSuccessAction

GraftingErrorAction

PageKey

RestoreStrategy

NavigationAction

ComponentIdentifier

Keypath

JSONPrimitive

JSONObject

JSONMappable

JSONKeyable

JSONValue

ParsedResponse

Defer

VisitResponse

Page

GraftResponse

PageResponse

Fragment

AllPages

SuperglueState

RootState

Meta

VisitMeta

VisitCreator

RemoteCreator

Dispatch

SuperglueStore

Handlers

UJSHandlers

HistoryState

SaveAndProcessPageThunk

MetaThunk

VisitMetaThunk

DefermentThunk

BasicRequestInit

NavigateTo

NavigationContextProps

NavigationProviderProps

BuildStore

BuildVisitAndRemote

SetupProps

ApplicationProps

Visit

VisitProps

Remote

RemoteProps

BeforeSave

ApplicationRemote

ApplicationVisit

Variables

GRAFTING_ERROR

const GRAFTING_ERROR: "@@superglue/GRAFTING_ERROR" = '@@superglue/GRAFTING_ERROR'

Defined in


GRAFTING_SUCCESS

const GRAFTING_SUCCESS: "@@superglue/GRAFTING_SUCCESS" = '@@superglue/GRAFTING_SUCCESS'

Defined in


rootReducer

const rootReducer: {superglue: superglueReducer;pages: pageReducer; }

Type declaration

Name
Type
Default value
Defined in

superglue

superglueReducer

pages

pageReducer

Defined in

Functions

saveAndProcessPage()

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

Parameter
Type

pageKey

string

page

Returns

Defined in


saveResponse()

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

Parameter
Type

...args

Returns

{}

Defined in


updateFragments()

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.value

Parameters

Parameter
Type

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

Parameter
Type

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

Parameter
Type

payload

object

payload.pageKey

string

Returns

{}

Defined in


beforeFetch()

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

Parameter
Type

payload

object

payload.fetchArgs

Returns

{}

Defined in


beforeVisit()

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

Parameter
Type

payload

object

payload.currentPageKey

string

payload.fetchArgs

Returns

{}

Defined in


beforeRemote()

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

Parameter
Type

payload

object

payload.currentPageKey

string

payload.fetchArgs

Returns

{}

Defined in


prepareStore()

Parameters

Parameter
Type

store

initialPage

path

string

Returns

void

Defined in


setup()

This is the setup function that the Application calls. Use this function if you like to build your own Application component.

Parameters

Parameter
Type

__namedParameters

Returns

Name
Type
Default value
Defined in

visit

-

remote

-

nextHistory

History

-

initialPageKey

string

-

ujs

handlers

Defined in


Application()

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

Parameter
Type

__namedParameters

Returns

Element

Defined in


getIn()

Parameters

Parameter
Type
Description

node

path

string

Returns

Defined in


urlToPageKey()

Converts a url to a PageKey.

Parameters

Parameter
Type
Description

url

string

Returns

Defined in

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

Re-exports

(state: , action: Action) =>

(state: , action: Action) =>

saveAndProcessPage(pageKey: string, page: | ):

|

saveResponse(...args: [{pageKey: string;page: ; }]): {}

[{pageKey: string;page: ; }]

updateFragments(payload: {name: string;path: string;pageKey: string;value: ;previousValue: ; }): {}

beforeFetch(payload: {fetchArgs: ; }): {}

beforeVisit(payload: {currentPageKey: string;fetchArgs: ; }): {}

beforeRemote(payload: {currentPageKey: string;fetchArgs: ; }): {}

prepareStore(store: , initialPage: , path: string): void

setup(__namedParameters: ): {visit: ;remote: ;nextHistory: History;initialPageKey: string;ujs: handlers; }

{visit: ;remote: ;nextHistory: History;initialPageKey: string;ujs: handlers; }

Application(__namedParameters: ): Element

getIn(node: , path: string):

Retrieves data from a JSON object using a

urlToPageKey(url: string):

lib/actions.ts:12
lib/actions.ts:13
lib/reducers/index.ts:235
lib/action_creators/index.ts:74
lib/actions.ts:15
lib/actions.ts:64
lib/actions.ts:86
lib/actions.ts:99
lib/actions.ts:117
lib/actions.ts:135
lib/actions.ts:154
lib/index.tsx:51
lib/index.tsx:73
lib/index.tsx:114
lib/utils/immutability.ts:22
lib/utils/url.ts:64
lib/reducers/index.ts:236
lib/reducers/index.ts:237
lib/index.tsx:99
lib/index.tsx:100
lib/index.tsx:101
lib/index.tsx:102
lib/index.tsx:103
useSuperglue
useContent
Visit
VisitProps
Remote
RemoteProps
BeforeSave
ApplicationRemote
ApplicationVisit
ApplicationVisit
ApplicationRemote
ApplicationVisit
ApplicationRemote
ApplicationVisit
ApplicationRemote
NavigationProvider
NavigationContext
FetchArgs
GraftingSuccessAction
GraftingErrorAction
FetchArgs
FetchArgs
FetchArgs
FetchArgs
FetchArgs
FetchArgs
PageKey
RestoreStrategy
NavigationAction
ComponentIdentifier
Keypath
JSONPrimitive
JSONObject
JSONMappable
JSONKeyable
JSONValue
ParsedResponse
Defer
VisitResponse
Page
GraftResponse
PageResponse
Fragment
AllPages
SuperglueState
RootState
Meta
VisitMeta
VisitCreator
RemoteCreator
Dispatch
SuperglueStore
Handlers
UJSHandlers
HistoryState
SaveAndProcessPageThunk
MetaThunk
VisitMetaThunk
DefermentThunk
BasicRequestInit
NavigateTo
NavigationContextProps
NavigationProviderProps
BuildStore
BuildVisitAndRemote
SetupProps
ApplicationProps
VisitResponse
GraftResponse
SaveAndProcessPageThunk
SaveAndProcessPageThunk
VisitResponse
JSONMappable
JSONMappable
SuperglueStore
VisitResponse
SetupProps
ApplicationProps
JSONMappable
JSONValue
Keypath
JSONValue
PageKey
PageKey
SuperglueState
SuperglueState
AllPages
AllPages
VisitResponse
GraftResponse
VisitResponse
JSONMappable
JSONMappable
SuperglueStore
VisitResponse
SetupProps
Handlers
ApplicationProps
JSONMappable