[go: nahoru, domu]

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

chore: Add memoize util compat #31800

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

GeoffCoxMSFT
Copy link
Member

Added memoize utility functions for react-utilities-compat

  • memoizeFunction is the most used utility across migrating teams.
  • functions are marked deprecated as they won't be brought forward to future versions of Fluent

@GeoffCoxMSFT GeoffCoxMSFT self-assigned this Jun 24, 2024
@GeoffCoxMSFT GeoffCoxMSFT requested review from a team as code owners June 24, 2024 20:35
@github-actions github-actions bot added this to the April Project Cycle Q1 2024 milestone Jun 24, 2024
@GeoffCoxMSFT GeoffCoxMSFT changed the title Add memoize util compat chore: Add memoize util compat Jun 24, 2024
@fabricteam
Copy link
Collaborator
fabricteam commented Jun 24, 2024

📊 Bundle size report

✅ No changes found

@GeoffCoxMSFT GeoffCoxMSFT enabled auto-merge (squash) June 25, 2024 20:13
@tudorpopams tudorpopams requested a review from Hotell June 26, 2024 12:05

/* eslint-disable @typescript-eslint/no-explicit-any */

declare class WeakMap {
Copy link
Contributor

Choose a reason for hiding this comment

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

this will probably explode if this would reach public API surface, with tslib setup for compat packages this should be removed as WeakMap is part of ts definitions

Copy link
Member Author

Choose a reason for hiding this comment

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

@Hotell I need to port utility functions with zero changes so that we can't introduce any bugs for partners. I don't expect it to ever be exported. Is the tslib WeakMap the exact same implementation? If not, then I think I need to leave this in here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand what's at play here but we might be forced to do some changes in order to not clash with v9 (not this case). I double-check the .d.ts rolluped bundle emit and it is not exposed so we are good with this one.

is the tslib WeakMap the exact same implementation?

obviously it's not :D it's strongly typed with generics and other jazz
image

but because it's declared like this declare class it would clash with existing typescript lib definitions

image

if it would be declared as interface global override ( allowed behaviour in TS ) it dangerous approach as it would affect whole application codebase , that's why I pointed this out.

hope it's more clear now.

Copy link
Contributor
@Hotell Hotell left a comment

Choose a reason for hiding this comment

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

feel free to resolve my last comment and ready to merge. ty

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.

None yet

5 participants