|
54 | 54 | // except nodejs, all other server sided need to be saved as without `server-` prefix
|
55 | 55 | const isServerSide =
|
56 | 56 | !platform.startsWith('client-') && !platform.startsWith('server-nodejs');
|
| 57 | +
|
| 58 | + let correctPlatform = platform; |
57 | 59 | if (isServerSide) {
|
58 |
| - const correctPlatform = platform.replaceAll(`server-`, ``); |
59 |
| - preferredPlatform.set(correctPlatform as Platform); |
| 60 | + correctPlatform = platform.replaceAll(`server-`, ``) as Platform; |
60 | 61 | }
|
61 | 62 |
|
| 63 | + preferredPlatform.set(correctPlatform as Platform); |
| 64 | +
|
62 | 65 | goto(`/docs/references/${version}/${platform}/${service}`, {
|
63 | 66 | noScroll: true
|
64 | 67 | });
|
|
87 | 90 | // nodejs has a `server-` prefix.
|
88 | 91 | const needsServerPrefix =
|
89 | 92 | !platform.startsWith('client-') && !platform.startsWith('server-');
|
90 |
| - if (needsServerPrefix) { |
| 93 | + if (needsServerPrefix && document.referrer) { |
91 | 94 | platformBindingForSelect = `server-${platform}` as Platform;
|
92 | 95 | }
|
93 | 96 | }
|
|
100 | 103 | const hasPlatformPrefix =
|
101 | 104 | $preferredPlatform.startsWith('client-') || $preferredPlatform.startsWith('server-');
|
102 | 105 |
|
103 |
| - if (!isSame) { |
| 106 | + /* `document.referrer` = don't redirect if the page was opened via a direct url hit */ |
| 107 | + if (!isSame && document.referrer) { |
104 | 108 | const platformMode = hasPlatformPrefix
|
105 | 109 | ? $preferredPlatform
|
106 | 110 | : `server-${$preferredPlatform}`;
|
|
123 | 127 | // the service description up to the first full stop, providing sufficient information.
|
124 | 128 | $: shortenedDescription = serviceDescription.substring(0, serviceDescription.indexOf('.') + 1);
|
125 | 129 |
|
126 |
| - $: platformBindingForSelect = platform; |
| 130 | + $: platformBindingForSelect = $page.params.platform as Platform; |
127 | 131 | $: platform = ($preferredPlatform ?? $page.params.platform) as Platform;
|
128 | 132 | $: platformType = platform.startsWith('client-') ? 'CLIENT' : 'SERVER';
|
129 | 133 | $: serviceName = serviceMap[data.service?.name];
|
|
0 commit comments