Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement type safety fallback #2933

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Conversation

Lelith
Copy link
Collaborator

@Lelith Lelith commented Nov 12, 2024

With some package update, typescript errors got interpreted as more strict. This implements the slug handling in a typesafe way with fallbacks.

@Lelith Lelith requested review from damann and a team as code owners November 12, 2024 08:43
@Lelith Lelith requested a review from mdmjg November 12, 2024 08:43
Copy link

changeset-bot bot commented Nov 12, 2024

⚠️ No Changeset found

Latest commit: d11f581

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Nov 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
forma-36 ✅ Ready (Inspect) Visit Preview Nov 12, 2024 8:43am

Copy link

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
CommonJS 112.03 KB (0%) 2.3 s (0%) 262 ms (+59.35% 🔺) 2.6 s
Module 110.84 KB (0%) 2.3 s (0%) 306 ms (+79.52% 🔺) 2.6 s

Comment on lines +298 to +299
const sectionSlug = section?.slug ?? 'default-section';
const itemSlug = item?.slug ?? 'default-item';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do these exist?

Copy link
Collaborator Author

@Lelith Lelith Nov 12, 2024

Choose a reason for hiding this comment

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

they usually are never undefined, but the type script error is now blocking the build, so i implemented a quick fallback to avoid the error.
the issue is that neither item nor section are properly typed and so this is the point where it falls trough. i can also go ahead and do a wider refactoring, fixing the initial types. but as all builds are failing at the moment, i wanted to have a quick fix.

Copy link
Collaborator

@denkristoffer denkristoffer Nov 12, 2024

Choose a reason for hiding this comment

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

I mean do these default sections and items exist or would something break if they actually got used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh, no, just the slug name and item would be displayed like that.

Copy link
Collaborator

@denkristoffer denkristoffer left a comment

Choose a reason for hiding this comment

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

Okay. I would like to understand what broke and why now, but we can get a hotfix in first.

@cf-remylenoir
Copy link
Collaborator

Are we able to pinpoint what package bump caused this regression?
Looking at the latest merged pull requests, I see that they were successful.

@Lelith Lelith merged commit 6cf1dcc into main Nov 15, 2024
12 checks passed
@Lelith Lelith deleted the fix/vercel_check_links_ts_error branch November 15, 2024 08:25
@Lelith
Copy link
Collaborator Author

Lelith commented Nov 15, 2024

@denkristoffer @cf-remylenoir i am also not sure, i was trying it out with the latest master where it failed immediately. and also versions above, so maybe its not an update in this package but one on circle ci? i mean its "just" a linter issue, so it seems like it could be based on some node or npm version or something like that.

Lelith added a commit that referenced this pull request Nov 25, 2024
Lelith added a commit that referenced this pull request Nov 26, 2024
* feat: export media queries

* feat: improve responsiveness of space switcher

* refactor: give proper class name

* chore: remove unneeded style

* feat: improve switcher responsiveness

* feat: adjust switcher label designs

* fix: switcher label overflows

* fix: adjust spacing left

* fix: do not show decorator on non space contexts

* fix: implement type safety fallback (#2933)

* feat: enable different mobile navigation breakpoint

* chore: update readme broken link

* chore: release 5.0.0-alpha.41
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.

3 participants