-
Notifications
You must be signed in to change notification settings - Fork 170
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
Remove unnecessary Tailwind class compilation calls #6534
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#14863 Bundle Size — 57.98MiB (~+0.01%).243afaf(current) vs 916e8b9 master#14861(baseline) Warning Bundle contains 70 duplicate packages – View duplicate packages Bundle metrics
|
Current #14863 |
Baseline #14861 |
|
---|---|---|
Initial JS | 40.97MiB (~+0.01% ) |
40.97MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 18% |
17.88% |
Chunks | 20 |
20 |
Assets | 22 |
22 |
Modules | 4153 |
4153 |
Duplicate Modules | 213 |
213 |
Duplicate Code | 27.33% |
27.33% |
Packages | 477 |
477 |
Duplicate Packages | 70 |
70 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #14863 |
Baseline #14861 |
|
---|---|---|
JS | 57.98MiB (~+0.01% ) |
57.97MiB |
HTML | 7.37KiB (-0.25% ) |
7.39KiB |
Bundle analysis report Branch fix/tailwind-fine-grained-dom-ob... Project dashboard
Generated by RelativeCI Documentation Report issue
…to fix/tailwind-fine-grained-dom-observer
seanparsons
approved these changes
Oct 17, 2024
bkrmendy
changed the title
Fine-grained Tailwind DOM observer
Remove unnecessary Tailwind class compilation
Oct 18, 2024
bkrmendy
requested review from
gbalint,
Rheeseyb,
ruggi,
balazsbajorics and
liady
October 21, 2024 09:17
Rheeseyb
approved these changes
Oct 21, 2024
bkrmendy
changed the title
Remove unnecessary Tailwind class compilation
Remove unnecessary Tailwind class compilation class
Oct 21, 2024
bkrmendy
changed the title
Remove unnecessary Tailwind class compilation class
Remove unnecessary Tailwind class compilation calls
Oct 21, 2024
liady
pushed a commit
that referenced
this pull request
Dec 13, 2024
# [Editions store](https://utopia.fish/p/2e4310b0-nostalgic-blackberry/?branch_name=fix-tailwind-fine-grained-dom-observer) ## Problem The Tailwind class generation code was running twice at the end of an interaction. Instead, we only want to re-run the tailwind compilation code when - a new element is added to the DOM or the `class` attribute of an element is updated - the Tailwind config file is updated (so tweaks to the tailwind config show up right away on the canvas) ## Fix - remove the `RequireFn` param from `useTailwindCompilation`. This param is problematic because a new `requireFn` is passed to `useTailwindCompilation` whenever `projectContents` changes, which triggers a re-compilation. Instead, the require fn is constructed in a `useRefEditorState` and used through that ref - The Tailwind config file is selected with a hook using `createSelector` for memoization - The mutation observer that runs the Tailwind class generation is only run if there were new nodes added (with potentially new Tailwind classes added to the DOM) or a `class` attribute was updated (with a potentially new Tailwind class) ### Out of scope This PR doesn't deal with the problem of generating new Tailwind classes only for the elements that have changed. This is due to how the library we use for tailwind class compilation works, finding a more fine-grained way to do this would be a more involved task ### Details - The PR also adds a test that tests tailwind style generation with Remix navigation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Editions store
Problem
The Tailwind class generation code was running twice at the end of an interaction. Instead, we only want to re-run the tailwind compilation code when
class
attribute of an element is updatedFix
RequireFn
param fromuseTailwindCompilation
. This param is problematic because a newrequireFn
is passed touseTailwindCompilation
wheneverprojectContents
changes, which triggers a re-compilation. Instead, the require fn is constructed in auseRefEditorState
and used through that refcreateSelector
for memoizationclass
attribute was updated (with a potentially new Tailwind class)Out of scope
This PR doesn't deal with the problem of generating new Tailwind classes only for the elements that have changed. This is due to how the library we use for tailwind class compilation works, finding a more fine-grained way to do this would be a more involved task
Details