( prevComponents: ExistingComponent[], prevRepository: string | null, nextComponents: ComponentInput[], nextRepository: string | null, )
| 56 | } |
| 57 | |
| 58 | function installRelevantChanged( |
| 59 | prevComponents: ExistingComponent[], |
| 60 | prevRepository: string | null, |
| 61 | nextComponents: ComponentInput[], |
| 62 | nextRepository: string | null, |
| 63 | ): boolean { |
| 64 | if ((prevRepository ?? null) !== (nextRepository ?? null)) { |
| 65 | return true; |
| 66 | } |
| 67 | |
| 68 | if (prevComponents.length !== nextComponents.length) { |
| 69 | return true; |
| 70 | } |
| 71 | |
| 72 | const prevSorted = [...prevComponents] |
| 73 | .sort((a, b) => a.sort_order - b.sort_order) |
| 74 | .map(fingerprintComponent) |
| 75 | .sort(); |
| 76 | const prevByKey = new Map( |
| 77 | prevComponents.map((c) => [ |
| 78 | componentKey(c.type, resolveComponentSlug(c)), |
| 79 | c, |
| 80 | ]), |
| 81 | ); |
| 82 | const nextSorted = nextComponents |
| 83 | .map((component) => |
| 84 | fingerprintComponent({ |
| 85 | ...component, |
| 86 | metadata: resolveComponentMetadata(component, prevByKey), |
| 87 | }), |
| 88 | ) |
| 89 | .sort(); |
| 90 | |
| 91 | for (let i = 0; i < prevSorted.length; i++) { |
| 92 | if (prevSorted[i] !== nextSorted[i]) return true; |
| 93 | } |
| 94 | return false; |
| 95 | } |
| 96 | |
| 97 | export const updatePluginAction = authActionClient |
| 98 | .metadata({ |
no test coverage detected