Skip to content

fix(#3733): blank page when dRep have @value in uri or label references#3737

Merged
bosko-m merged 1 commit into
developfrom
3733-bug-drep-details-page-produces-blank-screen-with-console-error
Jun 5, 2025
Merged

fix(#3733): blank page when dRep have @value in uri or label references#3737
bosko-m merged 1 commit into
developfrom
3733-bug-drep-details-page-produces-blank-screen-with-console-error

Conversation

@Ciabas
Copy link
Copy Markdown
Contributor

@Ciabas Ciabas commented Jun 5, 2025

List of changes

  • Fix blank page on dRep details when link or identity references contain objects { @value: ... } not strings

Checklist

  • related issue
  • My changes generate no new warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the changelog
  • I have added tests that prove my fix is effective or that my feature works

For own Verification

This sql can be used to extract the exact dRep data that was problematic for us and some other one with standard uri/label definitions.

SELECT
  dh.view AS drep_view,
  off_chain_vote_drep_data.given_name,
  jsonb_agg(
    jsonb_build_object(
    'uri',   COALESCE(
               CASE WHEN jsonb_typeof(ref->'uri') = 'string' THEN ref->>'uri' END,
               ref->'uri'->>'@value'
             ),
    '@type', ref->>'@type',
    'label', COALESCE(
               CASE WHEN jsonb_typeof(ref->'label') = 'string' THEN ref->>'label' END,
               ref->'label'->>'@value'
             )
  )
  ) AS link_references
FROM drep_hash dh
JOIN drep_registration dr ON dr.drep_hash_id = dh.id
JOIN voting_anchor va ON va.id = dr.voting_anchor_id
JOIN off_chain_vote_data ocvd ON ocvd.voting_anchor_id = va.id
JOIN off_chain_vote_drep_data ON off_chain_vote_drep_data.off_chain_vote_data_id = ocvd.id
CROSS JOIN LATERAL (
  SELECT ref
  FROM jsonb_array_elements(
    COALESCE((ocvd.json::jsonb)->'body'->'references', '[]'::jsonb)
  ) AS ref
  WHERE ref->>'@type' = 'Link'
) sub
WHERE dh.view = 'drep1jnmmkfwpta0yuwjchw0gu6csh75vy62088egy9n67d0zc7sn83m' OR dh.view = 'drep160v90f47eeqscq9aglzh8qxv8plskgxjtj9qgplgsz0kwskskjs'
GROUP BY dh.view, off_chain_vote_drep_data.given_name;

Before:
image

After:
image

@Ciabas Ciabas requested review from MSzalowski and Ryun1 as code owners June 5, 2025 14:26
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

5 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

@Ciabas Ciabas force-pushed the 3733-bug-drep-details-page-produces-blank-screen-with-console-error branch from 7524f8d to 44f29dc Compare June 5, 2025 14:57
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

2 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

✅ All checks succeeded

@bosko-m bosko-m merged commit 2d3a82c into develop Jun 5, 2025
5 checks passed
@bosko-m bosko-m deleted the 3733-bug-drep-details-page-produces-blank-screen-with-console-error branch June 5, 2025 16:02
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2025

@Ciabas
This PR is in the tag: develop-2d3a82c5091c81e23c871755c9ffba242958962d , for govtool-metadata-validation service

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2025

@Ciabas
This PR is in the tag: develop-2d3a82c5091c81e23c871755c9ffba242958962d , for govtool-backend service

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2025

@Ciabas
This PR is in the tag: develop-2d3a82c5091c81e23c871755c9ffba242958962d , for govtool-frontend service

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants