Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jun 8, 2022
1 parent a0919ed commit e5ee9c3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
16 changes: 8 additions & 8 deletions packages/core/BaseFeatureWidget/BaseFeatureDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const MAX_FIELD_NAME_WIDTH = 170

// these are always omitted as too detailed
const globalOmit = [
'_fmt',
'__jbrowsefmt',
'length',
'position',
'subfeatures',
Expand Down Expand Up @@ -248,7 +248,7 @@ function CoreDetails(props: BaseProps) {
end: number
strand: number
refName: string
_fmt: {
__jbrowsefmt: {
start?: number
end?: number
refName?: string
Expand All @@ -257,7 +257,7 @@ function CoreDetails(props: BaseProps) {
}

// eslint-disable-next-line no-underscore-dangle
const formattedFeat = { ...obj, ...obj._fmt }
const formattedFeat = { ...obj, ...obj.__jbrowsefmt }
const { start, strand, end, refName } = formattedFeat

const strandMap: Record<string, string> = {
Expand Down Expand Up @@ -441,8 +441,8 @@ export function Attributes(props: AttributeProps) {
prefix = [],
} = props
const omits = [...omit, ...globalOmit]
const { _fmt, ...rest } = attributes
const formattedAttributes = { ...rest, ..._fmt }
const { __jbrowsefmt, ...rest } = attributes
const formattedAttributes = { ...rest, ...__jbrowsefmt }

const maxLabelWidth = generateMaxWidth(
Object.entries(formattedAttributes).filter(
Expand Down Expand Up @@ -602,9 +602,9 @@ const BaseFeatureDetails = observer((props: BaseInputProps) => {
return null
}

// replacing undefined with helps with allowing fields to be hidden, setting
// null is not allowed by jexl so we set it to undefined to hide. see config
// guide. this replacement happens both here and when snapshotting the
// replacing undefined with null helps with allowing fields to be hidden,
// setting null is not allowed by jexl so we set it to undefined to hide. see
// config guide. this replacement happens both here and when snapshotting the
// featureData
const feature = JSON.parse(
JSON.stringify(featureData, (_, v) =>
Expand Down
21 changes: 10 additions & 11 deletions packages/core/BaseFeatureWidget/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export default function stateModelFactory(pluginManager: PluginManager) {
track: types.safeReference(
pluginManager.pluggableMstType('track', 'stateModel'),
),
display: types.safeReference(
pluginManager.pluggableMstType('display', 'stateModel'),
),
})
.volatile(() => ({}))
.actions(self => ({
Expand All @@ -69,15 +66,17 @@ export default function stateModelFactory(pluginManager: PluginManager) {

if (track) {
// eslint-disable-next-line no-underscore-dangle
feature._fmt = getConf(track, ['formatDetails', 'feature'], {
feature,
})
feature.__jbrowsefmt = getConf(
track,
['formatDetails', 'feature'],
{ feature },
)

const depth = getConf(track, ['formatDetails', 'depth'])

formatSubfeatures(feature, depth, subfeature => {
// eslint-disable-next-line no-underscore-dangle
subfeature._fmt = getConf(
subfeature.__jbrowsefmt = getConf(
track,
['formatDetails', 'subfeatures'],
{ feature: subfeature },
Expand Down Expand Up @@ -105,10 +104,10 @@ export default function stateModelFactory(pluginManager: PluginManager) {
// finalizedFeatureData avoids running formatter twice if loading from
// snapshot
return {
// replacing undefined with helps with allowing fields to be hidden,
// setting null is not allowed by jexl so we set it to undefined to
// hide. see config guide. this replacement happens both here and when
// displaying the featureData in base feature widget
// replacing undefined with null helps with allowing fields to be
// hidden, setting null is not allowed by jexl so we set it to
// undefined to hide. see config guide. this replacement happens both
// here and when displaying the featureData in base feature widget
finalizedFeatureData: JSON.parse(
JSON.stringify(featureData, (_, v) =>
typeof v === 'undefined' ? null : v,
Expand Down
1 change: 1 addition & 0 deletions plugins/data-management/src/AddTrackWidget/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe('tests on an LGV type system with view.assemblyNames, using URL', () =>
})

it('adds relative URL (BAM)', () => {
console.warn = jest.fn()
const { widget } = session
widget.setTrackData({
uri: 'volvox-sorted.bam',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ export const BaseLinearDisplay = types
'baseFeature',
{
view: getContainingView(self),
display: self,
track: getContainingTrack(self),
featureData: feature.toJSON(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ Object {
},
],
"formatDetails": Object {
"feature": "jexl:{name:'<a href=https://google.com/?q='+feature.name+'>'+feature.name+'</a>',random:'Wow'}",
"feature": "jexl:{name:'<a href=https://google.com/?q='+feature.name+'>'+feature.name+'</a>',random2:'Wow',phase:undefined,type:undefined}",
},
"name": "GFF3Tabix genes",
"trackId": "gff3tabix_genes",
Expand Down

0 comments on commit e5ee9c3

Please sign in to comment.