Skip to content

Conversation

@susnux
Copy link
Contributor

@susnux susnux commented Dec 21, 2025

This fixes an issue when using the View class as in this case the check 'property' in view will always return true,
thus the type check would fail when using the view class and navigation.register.

@susnux susnux requested review from CarlSchwan and artonge December 21, 2025 18:25
@susnux susnux added type: bug 🐛 Something isn't working 3. to review 3️⃣ Waiting for reviews labels Dec 21, 2025
Comment on lines +49 to +60
it('Can register a view with only required files', async () => {
const view = new View({
id: 'minimal',
name: 'Minimal view',
icon: '<svg></svg>',
getContents: () => Promise.reject(new Error('Not implemented')),
})

const navigation = new Navigation()
navigation.register(view)
expect(navigation.views).toEqual([view])
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is failing without this changes

@codecov
Copy link

codecov bot commented Dec 21, 2025

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.23%. Comparing base (233e287) to head (d2216ee).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lib/navigation/view.ts 92.59% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1438      +/-   ##
==========================================
- Coverage   89.47%   89.23%   -0.24%     
==========================================
  Files          25       25              
  Lines         703      706       +3     
  Branches      194      190       -4     
==========================================
+ Hits          629      630       +1     
- Misses         62       63       +1     
- Partials       12       13       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This fixes an issue when using the `View` class as in this case the
check `'property' in view` will always return true,
thus the typecheck would fail when using the view class and
`navigation.register`.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
Copy link
Contributor Author

susnux commented Dec 22, 2025

rebased and added the null check

Comment on lines +273 to +275
} else if (type === 'object' && (obj[property] === null || Array.isArray(obj[property]))) {
throw new Error(`View ${property} must be an object`)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added on the rebase

@susnux susnux merged commit ce0d836 into main Dec 22, 2025
10 checks passed
@susnux susnux deleted the fix/view branch December 22, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review 3️⃣ Waiting for reviews type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants