Skip to content

LF-5231: Fix unread indicator missing for notes fetched after seen at is set#4110

Merged
kathyavini merged 9 commits intointegrationfrom
LF-5231/Fix_unread_indicator_missing_for_notes_fetched_after_seen_at_is_set
Apr 13, 2026
Merged

LF-5231: Fix unread indicator missing for notes fetched after seen at is set#4110
kathyavini merged 9 commits intointegrationfrom
LF-5231/Fix_unread_indicator_missing_for_notes_fetched_after_seen_at_is_set

Conversation

@SayakaOno
Copy link
Copy Markdown
Collaborator

@SayakaOno SayakaOno commented Apr 9, 2026

Description

  • Update the farm note API URL from /farm_note to /farm_notes.
  • Rename last_seen_at in farm_notes_read table to read_through.
  • Save latest other user note's updated_at as read_through.
  • Avoid sending markFarmNotesRead request when notes have been read.

Jira link: https://lite-farm.atlassian.net/browse/LF-5231

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have ordered translation keys alphabetically (optional: run pnpm i18n to help with this)
  • I have added the GNU General Public License to all new files

@SayakaOno SayakaOno self-assigned this Apr 9, 2026
@SayakaOno SayakaOno added the bug Something isn't working label Apr 9, 2026
@SayakaOno SayakaOno force-pushed the LF-5231/Fix_unread_indicator_missing_for_notes_fetched_after_seen_at_is_set branch from 3830399 to a003280 Compare April 9, 2026 21:23
@SayakaOno SayakaOno changed the base branch from integration to LF-5213/Farm_notes_offline_support April 9, 2026 21:24
@SayakaOno SayakaOno changed the title Lf 5231: Fix unread indicator missing for notes fetched after seen at is set LF-5231: Fix unread indicator missing for notes fetched after seen at is set Apr 9, 2026
@SayakaOno SayakaOno marked this pull request as ready for review April 9, 2026 21:33
@SayakaOno SayakaOno requested review from a team as code owners April 9, 2026 21:34
@SayakaOno SayakaOno requested review from kathyavini and removed request for a team April 9, 2026 21:34
kathyavini
kathyavini previously approved these changes Apr 9, 2026
Copy link
Copy Markdown
Collaborator

@kathyavini kathyavini left a comment

Choose a reason for hiding this comment

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

Fantastic! The new logic makes total sense, and not calling the farm_notes_read endpoint every time the drawer is opened is 🔥

*/
export const up = async function (knex) {
return knex.schema.alterTable('farm_notes_read', (table) => {
table.renameColumn('last_read_at', 'read_through');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

read_through is a bit ambiguous -- here it means "read (the notes) through to this particularly timestamp", but the meaning that actually came to mind for me first is "has read through the entire list". Maybe that's just me?

I think I would prefer read_up_to or last_seen_note_time? But if read_through makes more sense to you, then it's also okay.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the suggestions! I wasn't sure about this although I went with one of Claude's suggestions. I'll update it to read_up_to!

Comment thread packages/webapp/src/sw.js Outdated
method: 'POST',
},
{
// This matcher will include farm_note/{uuid} paths
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re: the comment, should this now be /farm_notes/{uuid} ?

const handleOpenDrawer = () => {
setIsDrawerOpen(true);
markFarmNotesRead();
if (hasUnread) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

❤️

Comment thread packages/webapp/src/sw.js Outdated
{
// This matcher will include farm_note/{uuid} paths
matcher: ({ url }) => url.pathname.includes('/farm_note'),
matcher: ({ url }) => url.pathname.includes('/farm_notes'),
Copy link
Copy Markdown
Collaborator

@kathyavini kathyavini Apr 9, 2026

Choose a reason for hiding this comment

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

Oh, this was equally true for the original code, but I didn't catch it!

This will already match /farm_notes_read so the lower/dedicated matcher is never used. Perhaps narrow this one with the trailing slash (/farm_notes/) or expand the comment to be explicit?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh, thank you! I'll update the matcher!

Base automatically changed from LF-5213/Farm_notes_offline_support to integration April 13, 2026 21:13
@SayakaOno SayakaOno dismissed kathyavini’s stale review April 13, 2026 21:13

The base branch was changed.

Copy link
Copy Markdown
Collaborator Author

@SayakaOno SayakaOno left a comment

Choose a reason for hiding this comment

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

Thank you so much for paying attention to the details! 🙏❤️❤️
I'd appreciate it if you could check the updates!

Comment thread packages/webapp/src/sw.js Outdated
{
// This matcher will include farm_note/{uuid} paths
matcher: ({ url }) => url.pathname.includes('/farm_note'),
matcher: ({ url }) => url.pathname.includes('/farm_notes'),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh, thank you! I'll update the matcher!

*/
export const up = async function (knex) {
return knex.schema.alterTable('farm_notes_read', (table) => {
table.renameColumn('last_read_at', 'read_through');
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the suggestions! I wasn't sure about this although I went with one of Claude's suggestions. I'll update it to read_up_to!

Copy link
Copy Markdown
Collaborator

@kathyavini kathyavini left a comment

Choose a reason for hiding this comment

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

Looks great!

@kathyavini kathyavini added this pull request to the merge queue Apr 13, 2026
Merged via the queue into integration with commit 987cfb3 Apr 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants