Skip to content

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Jul 29, 2023

No description provided.

@netlify
Copy link

netlify bot commented Jul 29, 2023

Deploy Preview for selfoss canceled.

Name Link
🔨 Latest commit e2c447d
🔍 Latest deploy log https://app.netlify.com/sites/selfoss/deploys/64d010f1df4c5400072a93c2

@netlify
Copy link

netlify bot commented May 30, 2024

Deploy Preview for selfoss canceled.

Name Link
🔨 Latest commit 132ecdf
🔍 Latest deploy log https://app.netlify.com/sites/selfoss/deploys/677145d39e555400087ed28e

@netlify
Copy link

netlify bot commented Oct 3, 2025

Deploy Preview for selfoss canceled.

Name Link
🔨 Latest commit 24a2c2a
🔍 Latest deploy log https://app.netlify.com/projects/selfoss/deploys/69017062a9d760000875d24a

For some reason, ESLint’s `no-unused-vars` rule did not catch
that `PureApp` calls `EntriesFilter` until we switched to TypeScript.
React 19 removes propTypes, which were deprecated since 2017:
https://19.react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-deprecated-react-apis

The recommended replacement is using TypeScript.

Given that the code base is a mess but dynamic nature of JavaScript
gives us little hope of cleaning it without introducing a ton of regressions
I have decided to bite the bullet.

In this commit, I mostly used https://www.npmjs.com/package/js-to-ts-converter

Additionally, I had to perform the following manually changes:

- Update references in `package.json`, `index.html` and `selfoss-base`.
- Switch to `typescript-eslint`.
- Declare `selfoss` inside `window`.
They have been deprecated since 2017.
Also fix a bug in ajax code not spreading the rest field.
Using static for now to minimize required changes
We were accidentally clearing `statsDiff` in every iteration of the loop so its fields could only ever end up `-1` or `1` instead of actual tally of changed statuses.

This was broken since it was introduced in 4e44392
Avoid using stats names from constant since the indirection makes it harder to reason about for both humans and the TypeScript compiler.

Also add a note about the `updateStats` being broken with `itemStatuses` from server since this confused me a bit. For example, if user marks an entry as starred, server will return its unread status as well, and it would increase the statistic. For proper synchronization, we would need journal. Thankfully, the `dbOnline` module passes `updateStats = false`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants