chore: Introduce react compiler
Created by: dwesolow
📝 Description
This PR enables react compiler. As you can see in the lint CI job, we have bunch of errors there. Lot's of them are because compiler cannot replace 1:1 our memo (e.g. incorrect (current state):
const allMediaItems: (MediaItem | TestMediaItem)[] = useMemo(() => {
const { isSuccess, data } = mediaItemsQuery;
if (isSuccess && !isNil(data)) {
return data.pages.flatMap((item) => item.media as T[]);
}
return [];
}, [mediaItemsQuery]);
correct (without eslint warning):
const { isSuccess, data } = mediaItemsQuery;
const allMediaItems: (MediaItem | TestMediaItem)[] = useMemo(() => {
if (isSuccess && !isNil(data)) {
return data.pages.flatMap((item) => item.media as T[]);
}
return [];
}, [isSuccess, data]);
)
or we use ref during the render (Cannot access refs during render). I think the memo errors we should fix but I'm not sure if we should fix ref issues. Please check the lint logs. I'm waiting for your feedback.
✨ Type of Change
Select the type of change your PR introduces:
-
🐞 Bug fix – Non-breaking change which fixes an issue -
🚀 New feature – Non-breaking change which adds functionality -
🔨 Refactor – Non-breaking change which refactors the code base -
💥 Breaking change – Changes that break existing functionality -
📚 Documentation update -
🔒 Security update -
🧪 Tests
🧪 Testing Scenarios
Describe how the changes were tested and how reviewers can test them too:
-
✅ Tested manually -
🤖 Run automated end-to-end tests
✅ Checklist
Before submitting the PR, ensure the following:
-
🔍 PR title is clear and meaningful -
✍️ PR description clearly explains the changes and their reason -
📝 I have linked the PR to the corresponding GitHub Issues, if any -
💬 I have commented my code, especially in hard-to-understand areas -
📄 I have made corresponding changes to the documentation -
✅ I have added tests that prove my fix is effective or my feature works