fix(config): cast configuration values into proper types (#9829)

Refs #9808
This commit is contained in:
Oliwia Rogala
2024-04-18 11:04:05 +02:00
committed by GitHub
parent c2b63ab4d7
commit 7378821669
28 changed files with 359 additions and 83 deletions

View File

@@ -9,12 +9,12 @@ export const taggedOperations = (oriSelector, system) => (state, ...args) => {
// Filter, if requested
let filter = layoutSelectors.currentFilter()
if (filter) {
if (filter !== true && filter !== "true" && filter !== "false") {
if (filter !== true) {
taggedOps = fn.opsFilter(taggedOps, filter)
}
}
// Limit to [max] items, if specified
if (maxDisplayedTags && !isNaN(maxDisplayedTags) && maxDisplayedTags >= 0) {
if (maxDisplayedTags >= 0) {
taggedOps = taggedOps.slice(0, maxDisplayedTags)
}

View File

@@ -2,7 +2,5 @@ export const loaded = (ori, system) => (...args) => {
ori(...args)
const value = system.getConfigs().withCredentials
if(value !== undefined) {
system.fn.fetch.withCredentials = typeof value === "string" ? (value === "true") : !!value
}
system.fn.fetch.withCredentials = value
}

View File

@@ -4,7 +4,6 @@
import React from "react"
import PropTypes from "prop-types"
import ReactSyntaxHighlighter from "react-syntax-highlighter/dist/esm/light"
import get from "lodash/get"
const SyntaxHighlighter = ({
language,
@@ -13,8 +12,7 @@ const SyntaxHighlighter = ({
syntaxHighlighting = {},
children = "",
}) => {
const configs = getConfigs()
const theme = get(configs, "syntaxHighlight.theme")
const theme = getConfigs().syntaxHighlight.theme
const { styles, defaultStyle } = syntaxHighlighting
const style = styles?.[theme] ?? defaultStyle

View File

@@ -3,12 +3,10 @@
*/
import React from "react"
import PropTypes from "prop-types"
import get from "lodash/get"
const SyntaxHighlighterWrapper = (Original, system) => {
const SyntaxHighlighter = ({ renderPlainText, children, ...rest }) => {
const configs = system.getConfigs()
const canSyntaxHighlight = !!get(configs, "syntaxHighlight.activated")
const canSyntaxHighlight = system.getConfigs().syntaxHighlight.activated
const PlainTextViewer = system.getComponent("PlainTextViewer")
if (!canSyntaxHighlight && typeof renderPlainText === "function") {