Skip to content

fix(dashboard): validate imported widget config shape - #1128

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
TINEROW:fix-validate-widget-config-939
Aug 1, 2026
Merged

fix(dashboard): validate imported widget config shape#1128
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
TINEROW:fix-validate-widget-config-939

Conversation

@TINEROW

@TINEROW TINEROW commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

importWidgetConfig in src/app/hooks/useDashboardWidgets.tsx previously accepted any value where config.widgets was an array, then stored the raw entries into state and localStorage. Malformed entries (missing type/size/position, etc.) flowed into DashboardGrid and could crash the dashboard on next load since the layout is persisted.

This PR validates each imported widget against the Widget shape using a zod schema (widgetSchema / widgetListSchema) before accepting the import. Invalid configs are rejected, logged, and left out of state/persisted layout. Unit tests cover valid imports, malformed entries, and non-array configs.

Related Issue

Closes #939

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • Uses Lucide icons consistently
  • Responsive design implemented
  • Starknet best practices followed

@drips-wave

drips-wave Bot commented Jul 31, 2026

Copy link
Copy Markdown

@TINEROW Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 3d681f6 into rinafcode:main Aug 1, 2026
6 checks passed
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.

Validate imported widget config shape in useDashboardWidgets

2 participants