@stellar-expert/ui-framework 1.10.2 → 1.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import {useEffect, useState} from 'react'
2
2
  import isEqual from 'react-fast-compare'
3
3
  import {stringifyQuery} from '@stellar-expert/navigation'
4
4
  import {addVisibilityChangeListener, isDocumentVisible} from '../state/page-visibility-helpers'
5
- import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
5
+ import {useStellarNetwork} from '../state/stellar-network-hooks'
6
6
  import {fetchExplorerApi} from './explorer-api-call'
7
7
  import apiCache from './api-cache'
8
8
 
@@ -148,7 +148,8 @@ export function fetchData(url, ttl, processResult) {
148
148
  * @return {ExplorerApiResult}
149
149
  */
150
150
  export function useExplorerApi(apiEndpoint, {refreshInterval, ttl = 60, processResult, allowStaleDataTransition = false} = {}) {
151
- const endpointWithQuery = `${getCurrentStellarNetwork()}/${apiEndpoint}`
151
+ const network = useStellarNetwork()
152
+ const endpointWithQuery = `${network}/${apiEndpoint}`
152
153
  const [apiResponseData, updateApiResponseData] = useState(buildApiResult(endpointWithQuery))
153
154
  useEffect(() => {
154
155
  let componentUnmounted = false
@@ -1,7 +1,7 @@
1
1
  import {useRef} from 'react'
2
2
  import isEqual from 'react-fast-compare'
3
3
  import {parseQuery, stringifyQuery, navigation} from '@stellar-expert/navigation'
4
- import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
4
+ import {getCurrentStellarNetwork, useStellarNetwork} from '../state/stellar-network-hooks'
5
5
  import {useDependantState} from '../state/state-hooks'
6
6
  import {fetchExplorerApi} from './explorer-api-call'
7
7
  import apiCache from './api-cache'
@@ -397,6 +397,7 @@ export function useExplorerPaginatedApi(apiEndpoint,
397
397
  dependencies = []) {
398
398
  if (!apiEndpoint)
399
399
  throw new Error(`Invalid API endpoint: ${apiEndpoint}`)
400
+ const network = useStellarNetwork()
400
401
  const pinRef = useRef(null)
401
402
  if (typeof apiEndpoint === 'string') {
402
403
  const [path, query] = apiEndpoint.split('?')
@@ -408,7 +409,7 @@ export function useExplorerPaginatedApi(apiEndpoint,
408
409
  if (defaultQueryParams.order) {
409
410
  defaultSortOrder = defaultQueryParams.order
410
411
  }
411
- const endpoint = includeNetwork ? `${getCurrentStellarNetwork()}/${apiEndpoint.path}` : apiEndpoint.path
412
+ const endpoint = includeNetwork ? `${network}/${apiEndpoint.path}` : apiEndpoint.path
412
413
 
413
414
  const [apiResponseData, updateApiResponseData] = useDependantState(() => {
414
415
  const res = new PaginatedListViewModel(endpoint, {
@@ -57,7 +57,7 @@ ${navigator.userAgent}`
57
57
  <BlockSelect as="div">
58
58
  <div className="micro-space">{text}</div>
59
59
  <div className="text-tiny">
60
- <pre>{stack}</pre>
60
+ <pre style={{whiteSpace: 'pre-wrap'}}>{stack}</pre>
61
61
  <div>{navigator.userAgent}</div>
62
62
  </div>
63
63
  </BlockSelect>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/ui-framework",
3
- "version": "1.10.2",
3
+ "version": "1.10.4",
4
4
  "description": "StellarExpert shared UI components library",
5
5
  "main": "index.js",
6
6
  "module": "./index.js",
@@ -21,7 +21,7 @@
21
21
  "@stellar-expert/client-cache": "github:stellar-expert/client-cache",
22
22
  "@stellar-expert/formatter": "^2.3.0",
23
23
  "@stellar-expert/navigation": "github:stellar-expert/navigation#v1.0.2",
24
- "@stellar-expert/tx-meta-effects-parser": "^5.0.2",
24
+ "@stellar-expert/tx-meta-effects-parser": "^5.0.4",
25
25
  "classnames": ">=2",
26
26
  "prop-types": ">=15",
27
27
  "qrcode.react": "^3.1.0",