-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Retain DOM nodes during streaming SSR updates #48258
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
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
8cdc622
Start on a test project for Web.JS
SteveSandersonMS a9ae397
Regenerate yarn lockfile
SteveSandersonMS b4d74c5
Begin implementing EditDistance
SteveSandersonMS 94ba992
Try disabling workspaces because of CI issue
SteveSandersonMS ea5f6e1
Try to make the tests run in CI
SteveSandersonMS db8fc65
Report jest results to AzDO
SteveSandersonMS cc0ae15
Remove ComparisonResult
SteveSandersonMS db422e6
Instead of tracking equality results, track operations
SteveSandersonMS edf3ee6
Clean up
SteveSandersonMS 5f82bca
Generalize to ItemList<T>
SteveSandersonMS cc818a8
Optimizations for edit distance
SteveSandersonMS 82720db
Bring back ComparisonResult
SteveSandersonMS 587ed3e
Support 'update' operation
SteveSandersonMS 0e0e4db
Renames
SteveSandersonMS 638af7a
Clean up
SteveSandersonMS da1af53
Optimize EditDistance results to skip returning Keep for common prefi…
SteveSandersonMS f54984d
Tidy
SteveSandersonMS f0953a0
Starting to implement the actual DOM updates. Currently only supports…
SteveSandersonMS 1899f45
Handle insert
SteveSandersonMS e17416e
Deal with text nodes and comments
SteveSandersonMS 5aa0a64
Renames for clarity
SteveSandersonMS caa2e9b
Rephrasings for clarity
SteveSandersonMS 527c8a7
Basic element handling
SteveSandersonMS 1a42d36
Better tests
SteveSandersonMS 67f02a9
Updates attributes
SteveSandersonMS f8969c0
Insert attributes
SteveSandersonMS 465c4bc
Delete attributes, albeit with a messy implementation
SteveSandersonMS 9103d66
Update DomSync.test.ts
SteveSandersonMS 676b110
Tidy up attribute handling
SteveSandersonMS 481c8a1
Notes on @key
SteveSandersonMS 4c1e6e9
Recurse into elements
SteveSandersonMS ae27a63
Use new DOM sync algorithm for streaming SSR
SteveSandersonMS 3070ca0
Test to show how form values are handled
SteveSandersonMS 99c5ae0
E2E test
SteveSandersonMS a142214
Update JS built files
SteveSandersonMS fc22a70
See it if builds in CI now without this workaround
SteveSandersonMS 4f3c057
Revert "See it if builds in CI now without this workaround"
SteveSandersonMS 239e16e
Refactoring so the attribute setting logic can be shared
SteveSandersonMS 435fc83
Add some failing test cases
SteveSandersonMS 574b4b0
Update the refactoring to better represent the different requirements
SteveSandersonMS b8ebca1
DomSync input element handling
SteveSandersonMS ef4d392
Update JS files
SteveSandersonMS e223cde
Allow disabling DOM preservation
SteveSandersonMS a6ef0ff
Update .js file
SteveSandersonMS fbf3de2
Tiny optimization
SteveSandersonMS b26b9e6
Update .js
SteveSandersonMS ddde8f2
Make it work with deferred values
SteveSandersonMS f45da57
Update .js
SteveSandersonMS 01a94cd
Fix bug I just introduced
SteveSandersonMS 63a7e12
Update .js
SteveSandersonMS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
workspaces-experimental false | ||
11 changes: 10 additions & 1 deletion
11
src/Components/Web.JS/Microsoft.AspNetCore.Components.Web.JS.npmproj
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
/* | ||
* For a detailed explanation regarding each configuration property, visit: | ||
* https://jestjs.io/docs/configuration | ||
*/ | ||
|
||
module.exports = { | ||
// All imported modules in your tests should be mocked automatically | ||
// automock: false, | ||
|
||
// Stop running tests after `n` failures | ||
// bail: 0, | ||
|
||
// The directory where Jest should store its cached dependency information | ||
// cacheDirectory: "C:\\Users\\stevesa\\AppData\\Local\\Temp\\jest", | ||
|
||
// Automatically clear mock calls, instances, contexts and results before every test | ||
// clearMocks: false, | ||
|
||
// Indicates whether the coverage information should be collected while executing the test | ||
// collectCoverage: false, | ||
|
||
// An array of glob patterns indicating a set of files for which coverage information should be collected | ||
// collectCoverageFrom: undefined, | ||
|
||
// The directory where Jest should output its coverage files | ||
// coverageDirectory: undefined, | ||
|
||
// An array of regexp pattern strings used to skip coverage collection | ||
// coveragePathIgnorePatterns: [ | ||
// "\\\\node_modules\\\\" | ||
// ], | ||
|
||
// Indicates which provider should be used to instrument code for coverage | ||
coverageProvider: "v8", | ||
|
||
// A list of reporter names that Jest uses when writing coverage reports | ||
// coverageReporters: [ | ||
// "json", | ||
// "text", | ||
// "lcov", | ||
// "clover" | ||
// ], | ||
|
||
// An object that configures minimum threshold enforcement for coverage results | ||
// coverageThreshold: undefined, | ||
|
||
// A path to a custom dependency extractor | ||
// dependencyExtractor: undefined, | ||
|
||
// Make calling deprecated APIs throw helpful error messages | ||
// errorOnDeprecated: false, | ||
|
||
// The default configuration for fake timers | ||
// fakeTimers: { | ||
// "enableGlobally": false | ||
// }, | ||
|
||
// Force coverage collection from ignored files using an array of glob patterns | ||
// forceCoverageMatch: [], | ||
|
||
// A path to a module which exports an async function that is triggered once before all test suites | ||
// globalSetup: undefined, | ||
|
||
// A path to a module which exports an async function that is triggered once after all test suites | ||
// globalTeardown: undefined, | ||
|
||
// A set of global variables that need to be available in all test environments | ||
// globals: {}, | ||
|
||
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. | ||
// maxWorkers: "50%", | ||
|
||
// An array of directory names to be searched recursively up from the requiring module's location | ||
// moduleDirectories: [ | ||
// "node_modules" | ||
// ], | ||
|
||
// An array of file extensions your modules use | ||
// moduleFileExtensions: [ | ||
// "js", | ||
// "mjs", | ||
// "cjs", | ||
// "jsx", | ||
// "ts", | ||
// "tsx", | ||
// "json", | ||
// "node" | ||
// ], | ||
|
||
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module | ||
// moduleNameMapper: {}, | ||
|
||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader | ||
// modulePathIgnorePatterns: [], | ||
|
||
// Activates notifications for test results | ||
// notify: false, | ||
|
||
// An enum that specifies notification mode. Requires { notify: true } | ||
// notifyMode: "failure-change", | ||
|
||
// A preset that is used as a base for Jest's configuration | ||
// preset: undefined, | ||
|
||
// Run tests from one or more projects | ||
// projects: undefined, | ||
|
||
// Use this configuration option to add custom reporters to Jest | ||
reporters: [ | ||
"default", | ||
["./node_modules/jest-junit/index.js", { "outputDirectory": "../../../artifacts/log/", "outputName": `${process.platform}` + ".components-webjs.junit.xml" }] | ||
], | ||
|
||
// Automatically reset mock state before every test | ||
// resetMocks: false, | ||
|
||
// Reset the module registry before running each individual test | ||
// resetModules: false, | ||
|
||
// A path to a custom resolver | ||
// resolver: undefined, | ||
|
||
// Automatically restore mock state and implementation before every test | ||
// restoreMocks: false, | ||
|
||
// The root directory that Jest should scan for tests and modules within | ||
// rootDir: undefined, | ||
|
||
// A list of paths to directories that Jest should use to search for files in | ||
// roots: [ | ||
// "<rootDir>" | ||
// ], | ||
|
||
// Allows you to use a custom runner instead of Jest's default test runner | ||
// runner: "jest-runner", | ||
|
||
// The paths to modules that run some code to configure or set up the testing environment before each test | ||
// setupFiles: [], | ||
|
||
// A list of paths to modules that run some code to configure or set up the testing framework before each test | ||
// setupFilesAfterEnv: [], | ||
|
||
// The number of seconds after which a test is considered as slow and reported as such in the results. | ||
// slowTestThreshold: 5, | ||
|
||
// A list of paths to snapshot serializer modules Jest should use for snapshot testing | ||
// snapshotSerializers: [], | ||
|
||
// The test environment that will be used for testing | ||
testEnvironment: "jsdom", | ||
|
||
// Options that will be passed to the testEnvironment | ||
// testEnvironmentOptions: {}, | ||
|
||
// Adds a location field to test results | ||
// testLocationInResults: false, | ||
|
||
// The glob patterns Jest uses to detect test files | ||
// testMatch: [ | ||
// "**/__tests__/**/*.[jt]s?(x)", | ||
// "**/?(*.)+(spec|test).[tj]s?(x)" | ||
// ], | ||
|
||
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped | ||
// testPathIgnorePatterns: [ | ||
// "\\\\node_modules\\\\" | ||
// ], | ||
|
||
// The regexp pattern or array of patterns that Jest uses to detect test files | ||
// testRegex: [], | ||
|
||
// This option allows the use of a custom results processor | ||
// testResultsProcessor: undefined, | ||
|
||
// This option allows use of a custom test runner | ||
// testRunner: "jest-circus/runner", | ||
|
||
// A map from regular expressions to paths to transformers | ||
transform: { | ||
'^.+\\.tsx?$': ['@swc/jest'], | ||
'^.+\\.jsx?$': ['@swc/jest'], | ||
}, | ||
|
||
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation | ||
// transformIgnorePatterns: [ | ||
// "\\\\node_modules\\\\", | ||
// "\\.pnp\\.[^\\\\]+$" | ||
// ], | ||
|
||
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them | ||
// unmockedModulePathPatterns: undefined, | ||
|
||
// Indicates whether each individual test should be reported during the run | ||
// verbose: undefined, | ||
|
||
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode | ||
// watchPathIgnorePatterns: [], | ||
|
||
// Whether to use watchman for file crawling | ||
// watchman: true, | ||
}; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
export interface SsrStartOptions { | ||
/** | ||
* If true, does not attempt to preserve DOM nodes when performing dynamic updates to SSR content | ||
* (for example, during enhanced navigation or streaming rendering). | ||
*/ | ||
disableDomPreservation?: boolean; | ||
} |
This file contains hidden or 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately yes. Without it, it fails in CI due to a yarn restore issue related to Jest and its TypeScript integration.