Skip to content

Fix Edit Metadata to always pre-populate latest metadata - #1039

Open
youseihuayu-wonderful wants to merge 6 commits into
IQSS:developfrom
youseihuayu-wonderful:fix/1024-edit-metadata-latest-version
Open

Fix Edit Metadata to always pre-populate latest metadata#1039
youseihuayu-wonderful wants to merge 6 commits into
IQSS:developfrom
youseihuayu-wonderful:fix/1024-edit-metadata-latest-version

Conversation

@youseihuayu-wonderful

Copy link
Copy Markdown

Summary

  • Fixes Edit Metadata: should always pre-populate the latest metadata #1024: when opening Edit Metadata from an older dataset version, the SPA now pre-fills latest metadata (:latest — draft if present, otherwise latest published), matching JSF and EditDatasetTermsFactory.
  • Root cause: EditDatasetMetadataFactory used the browsed version query param (e.g. 1.0). It now ignores that param and always fetches DatasetNonNumericVersion.LATEST.
  • Adds component regression tests asserting getByPersistentId(..., ':latest', ...) and not "1.0".

Test plan

  • Local: npx cypress run --component --spec tests/component/sections/edit-dataset-metadata/EditDatasetMetadataFactory.spec.tsx2 passing
  • CI component tests
  • Manual: publish v1 without subtitle → publish v2 with subtitle → browse ?version=1.0 → Edit Metadata → subtitle shows v2 value
  • Manual: browsing ?version=1.0 without editing still shows historical v1 metadata

Notes

  • Browse-page version selection is unchanged.
  • Optional docs under docs/issues/ are included for review context; happy to drop them from the PR if preferred.

youseihuayu-wonderful and others added 3 commits July 31, 2026 12:22
Ignore the browsed version query param in EditDatasetMetadataFactory and
fetch :latest instead, matching Edit Terms and JSF. Add component
regression coverage and an issue playbook with verification steps.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document before/after fetch arguments, form outputs for the IQSS#1024
scenario, and the exact automated/manual checks that complete the fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep draft title/body on the branch for later publishing, and avoid
unbound-method lint errors in the Factory regression spec.

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Author

@ChengShi-1 @pdurbin
Could you please take a look at this PR when you have a chance? Thank you!

@pdurbin pdurbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The changes to EditDatasetMetadataFactory.tsx make sense to me but I didn't test them. I'm also not super familiar with the codebase so I'm clicking "comment" rather than "approve". I did leave a couple comments.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will this and the other files under "docs/issues" be removed before merging? 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, now I see you wrote this:

"Optional docs under docs/issues/ are included for review context; happy to drop them from the PR if preferred."

In my opinion, they are a bit noisy but let's see what others think! 😅

Comment on lines +21 to +23
// Always load the latest version (draft if exists, otherwise latest published).
// Ignore the browsed `version` query param so Edit Metadata matches JSF / Edit Terms
// (IQSS/dataverse-frontend#1024).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please copy this (or something similar) into CHANGELOG.md as well.

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Author

@pdurbin Done — added under [Unreleased] → ### Fixed in CHANGELOG.md (same substance as this comment, phrased to match the changelog style). See the latest commit on this PR.

@ChengShi-1
ChengShi-1 self-requested a review August 3, 2026 15:49
@ChengShi-1 ChengShi-1 self-assigned this Aug 3, 2026
@ChengShi-1 ChengShi-1 moved this to In Review 🔎 in IQSS Dataverse Project Aug 3, 2026

@ChengShi-1 ChengShi-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good overall. I tested locally and it was working well. Could you solve some comments here and remove extra docs?

const persistentId = searchParams.get('persistentId') ?? undefined
const searchParamVersion = searchParams.get('version') ?? undefined
const version = searchParamVersionToDomainVersion(searchParamVersion)
// Always load the latest version (draft if exists, otherwise latest published).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove comments here

).resolves(metadataBlocksInfoOnCreateMode)
})

it('always fetches :latest when the URL carries an older published version (issue #1024)', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you remove the issue number here (issue #1024) ?

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Author

@chengshi — I removed the comments and the issue number from the test title. please take a look!

@ChengShi-1

Copy link
Copy Markdown
Contributor

Hi @youseihuayu-wonderful , thanks. Also, could you drop docs/issue ?

@ChengShi-1 ChengShi-1 closed this Aug 3, 2026
@ChengShi-1 ChengShi-1 reopened this Aug 3, 2026
@ChengShi-1

Copy link
Copy Markdown
Contributor

I clicked a wrong button to close it but i didn't mean it :( sorry for this

Co-authored-by: Cursor <cursoragent@cursor.com>
@youseihuayu-wonderful

Copy link
Copy Markdown
Author

@ChengShi-1 Dropped docs/issues from the PR.

@ChengShi-1 ChengShi-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me!

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Aug 3, 2026
@pdurbin

pdurbin commented Aug 4, 2026

Copy link
Copy Markdown
Member

I just clicked the "Approve workflows to run" button:

Screenshot 2026-08-04 at 3 14 12 PM

Update: And now there are failing checks:

Screenshot 2026-08-04 at 3 15 42 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for QA ⏩

Development

Successfully merging this pull request may close these issues.

Edit Metadata: should always pre-populate the latest metadata

3 participants